Levels Tought:
University
Teaching Since: | Apr 2017 |
Last Sign in: | 345 Weeks Ago, 4 Days Ago |
Questions Answered: | 9562 |
Tutorials Posted: | 9559 |
bachelor in business administration
Polytechnic State University Sanluis
Jan-2006 - Nov-2010
CPA
Polytechnic State University
Jan-2012 - Nov-2016
Professor
Harvard Square Academy (HS2)
Mar-2012 - Present
Write a program which repeatedly asks the user to enter students' score in a test until the user enters -1. Once the user enters -1, the program outputs the average of all the grades. Use a while loop to keep getting a new grade (grade must be from 0 to 100). Keep count of how many grades have been entered and calculate the total of all the grades. To compute the average: Divide the total grades by number of grades.
Compute the highest grade among all the grades. (Hint: highest grade: assume the first one to be the highest grade, for each new number, check whether it is higher than the current highest (max), if it is, set it as our new highest. At last, output the average and highest grade.)
Note: Double check that the average calculated at the end doesnA????1t include the -1.
Example of input/output: To get final average and highest score, enter -1.
Enter the score for student 1: 100
Enter the score for student 2: 65
Enter the score for student 3: 40
Enter the score for student 4: 80
Enter the score for student 5: 80
Enter the score for student 6: -1
The average is 73
The highest score is 100
Â
-----------