Write Code Example 1 ENGLISH

Problem:  

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. If it is, get the name of that student. 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.

SOLUTION:

get a test score
while there are still tests left
      if it is below 50
            tell the user it is below 50
            get this person’s name
      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

Leave a Reply

Your email address will not be published. Required fields are marked *