When the user enters the sentinel value

When the user finally enters the sentinel value of -1, the loop in Listing 7 will terminate immediately.

This will leave a correct value for the grade counter and a correct value for the sum of the grades in the variables named count and sum respectively.