Write Code Example

Write Code #1

Write a program to get test scores from the user until a 0 test score is entered. For each test, tell if it is below 50.  After you finish getting all the scores, print out the average of all the even scores, the highest odd score, and the number of scores in the 80s.


get a test score
while there are still tests left
      if it is below 50
            tell the user it is below 50
      if this score is even
            add this test score to the total for even test scores
            add 1 to the count of even scores
      if this score is odd
            if this is the highest odd score so far
                 change the high odd score to this score
      if this score is greater that 79 and less than 90
            add 1 to the count for scores in the 80s
     get the next score
print the total of even scores divided by the count of even scores
print the highest odd score
print the count of scores in the 80s

See It Run