Practice
Sentinel Total and High Count
2024/May/June·Variant 2·Q6·[8 marks]
EASYLoops
Read real numbers until the sentinel value 9999.9 is entered. The sentinel is not part of the data.
Output two lines: the total of the numbers entered, then how many of those numbers were greater than 100.
Input: One or more real numbers, ending with 9999.9.
Output: The total, then the count of values greater than 100.
Example:
Input: 10
150
9999.9
Output: 160
1
Sample Test Cases
Test 1: One value above 100
Inputs: 10, 150, 9999.9
Expected: 160
1
Test 2: Immediate sentinel
Inputs: 9999.9
Expected: 0
0