Average Order Value
Riverbend Supply runs a small online shop. Its evening dashboard carries one headline figure: what a typical order was worth today. The till exports the total of every completed order, one per line, with nothing added up in advance. A busy day and a quiet day both have to produce a figure in the same shape, so the dashboard can line them up.
Task: Print the average value of today's orders — the arithmetic mean, every order counted once.
Input
The first line holds a single integer n, the number of orders. Each of the next n lines holds one order total, a decimal number of dollars. There is always at least one order.
Output
One line holding the average with exactly two digits after the decimal point. Trailing zeros are kept, so an average of ten dollars prints as 10.00 — not 10.0, and not 10.
Example:
Input:
3
20.0
35.5
44.5
Output:
33.33
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