Repetition ... Indefinite Loop

while-loop: indefinite loop



Description

This program illustrates repetition... looping. It builds on the previous program showing grade averaging. We have extended the previous program to compute averages for an unknown number of students.

It illustrates these new concepts:

  1. while loop, an indefinite loop structure in which the execution of some collection of program statements is repeated an unknown number of times.
  2. text data type (as input, comparisons)
  3. boolean data type (to end the while loop)

Input

The user is first asked to give the number of grades each student has. Then the user enters those grades for a student. After the average is produced, the user is asked if another student should be processed. If yes, then then more grades are requested. If no, the program ends.

Output

The program prints the average of the grades given for a student. An average is printed as many times as the user enters grades.

Termination

The program terminates when the user types "no" to the question about are there more students to process.