Average of the Passing Students
Back at Fenwick College, the pass mark on the end-of-term paper is 60, and a mark of exactly 60 is a pass. One line of the examiners' report quotes the average mark among the students who passed, leaving the failures out on purpose: a cohort with a handful of very low marks would otherwise read as weaker than it was taught. Every set of marks handed over contains at least one pass, so that line always has something to say.
Task: Print the average mark of the students who passed — the arithmetic mean, each passing mark counted once.
Input
The first line holds a single integer n, the number of students. Each of the next n lines holds one mark, which may carry decimals. At least one mark is 60 or above.
Output
One line holding that average with exactly two digits after the decimal point. Trailing zeros are kept, so an average of exactly 75 prints as 75.00.
Example:
Input:
4
45
70
80
55
Output:
75.00
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in