This program calculates the numeric mean (average) of several numbers. This is an example of using a while loop control structure. This input loop repeats until the user enters the sentinel value of -1 to show that they have completed entering the grades to be averaged. The program maintains a running count of the number of grades submitted and their total and then calculates the average when the user indicates by the sentinel that they have no more grades to submit.
This fairly trivial program demonstrates the use of the switch control structure.