Mean before 0

Given a sequence of floating-point numbers, your task is to find out the mean of all the numbers that appear before the first 0 in the sequence.
The input of the program contains a sequence of floating-point numbers. Everything after 0 should be ignored.
The program should print a single number - the average of the sequence before 0.
Input
6.4
5.6
10
2
0
5

Output
6
 
To check your solution you need to sign in
Sign in to continue