Arithmetic mean of array elements
JavaScript
Easy
arrays
Task «Arithmetic mean of array elements»
The input is an array of integers. It is necessary to calculate the arithmetic mean of all elements of the array. If the array is empty, output 0.
Input Format
First line: an integer N (0 ≤ N ≤ 1000) — the number of elements. Second line: N integers separated by spaces.
Output Format
One number — the arithmetic mean, rounded to two decimal places.
Examples
Example 1
INPUT
4
2 4 6 8
OUTPUT
5.0
Example 2
INPUT
3
1 2 3
OUTPUT
2.0
main.js