Write a pseudocode algorithm which inputs numeric scores and outputs how many of them are over 100. The end of the data is signalled by a user input of -1.

Answered on

Answer: ``` Initialize a counter to keep track of scores over 100 and set it to 0. While true: Prompt the user to input a score. Read the user's input. If the input is -1: Break out of the loop as it signifies the end of data input. If the input is greater than 100: Increment the counter by 1. After the loop, output the value of the counter. ```

In more structured pseudocode:

``` counter <- 0 REPEAT OUTPUT "Enter a score (or -1 to end): " INPUT score IF score = -1 THEN EXIT REPEAT ENDIF IF score > 100 THEN counter <- counter + 1 ENDIF UNTIL false OUTPUT "Number of scores over 100: ", counter ```

Related Questions