Problem D
Scores
Write a program that takes a sequence of real numbers, removes the three lowest numbers and prints out the sum of the remaining numbers.
An error message should be printed if the number of floats
entered is
Input
The program recieves one line as input, a sequence
In the tests,
In the samples below, the first and only line of the input
contains the sequence
Output
The output should consist of either:
-
The string “At least 3 scores needed!”, if fewer than three scores were input.
-
The string “Sum of scores (3 lowest removed): {
}” where is the sum of of all the numbers in the sequence except the lowest three, if three or more scores were input.The sum your program outputs must be within
from the correct answer.
Sample Input 1 | Sample Output 1 |
---|---|
1.1 |
At least 3 scores needed! |
Sample Input 2 | Sample Output 2 |
---|---|
1.1 2.2 |
At least 3 scores needed! |
Sample Input 3 | Sample Output 3 |
---|---|
1.1 2.2 3.3 |
Sum of scores (3 lowest removed): 0.0 |
Sample Input 4 | Sample Output 4 |
---|---|
2.3 4.5 1.1 7.8 3.4 5.6 |
Sum of scores (3 lowest removed): 17.9 |
Sample Input 5 | Sample Output 5 |
---|---|
-2.3 4.5 6.8 9.9 2.4 6.5 11.3 12.9 2.8 8.5 |
Sum of scores (3 lowest removed): 60.4 |