LoopWithCounter Program
Description
There are 10 students, each with a test score.This program inputs 10 test scores, calculates the average score, and finds the highest score
(assume there is no tie).
Because we know in advance that there are 10 students, so the counter-controlled while loop is used.
Associated Concepts:
Counter-controlled while loop
Algorithm:
Initialize sum variable to zero
Initialize highest variable to a very small number
Use a counter-controlled while loop to input 10 test scores
If the input score is valid
Add the score to sum
Assign the score to highest if the score is larger than the current highest value
Otherwise
Print an error message
Once the loop is ended, calculate the average
Print the result
Initialize highest variable to a very small number
Use a counter-controlled while loop to input 10 test scores
If the input score is valid
Add the score to sum
Assign the score to highest if the score is larger than the current highest value
Otherwise
Print an error message
Once the loop is ended, calculate the average
Print the result