Compute and display the average
The code in Listing 5 will first confirm that the counter value is not equal to 0.
This would be the case if the user had entered a -1 when requested to enter a grade in Listing 3.