Read the next grade

Then the code in the body of the loop in Listing 4 will request and read another grade, or a -1 to quit.

The -1 is the so-called sentinel value.

The loop will continue to iterate, reading grades, adding them to the accumulator, and incrementing the counter until the user enters the sentinel value of -1.