Compute and display the average grade
At that point, control will transfer to the code in Listing 8.
If the value of the counter is greater than zero, the average grade will be computed and displayed. Otherwise, the program will quietly terminate with no output.
Listing 8 signals the end of the doSomething function and the end of the program.