Repetition ... Definite Loop

for-loop: definite loop



Description

This program illustrates repetition... looping. It builds on the previous program showing if-then-else statements.

It illustrates these new concepts:

  1. for loop, a definite loop structure in which the execution of some collection of program statements is repeated a specific number of times.
  2. controlling the for loop with a number given by the user

Input

The program asks for a number, the number of grades to be averaged. (this number is used to fix the number of times the for loop repeats). The user will then be asked to input the grades one at a time.

Output

The program computes the average of the grades and prints the average.

Termination

The program terminates automatically after all grades are input by the user.