With several tries, I didn't find out where I made a mistake for the last requirement of this task.
"The displayed result should match the specification for any input data." is not passed.
package com.codegym.task.task05.task0507;
import java.io.*;
/*
Arithmetic mean
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
double result = 0.0f;
int sum = 0;
int i = 0;
while(true)
{
String numbers = br.readLine();
int num = Integer.parseInt(numbers);
if(num == -1)
{
break;
}
if(num != 0)
{
sum += num;
i++;
}
}
if(sum == 0)
{
result = 0.0;
}
else
{
result = (double)sum/(double)i;
}
System.out.print(result);
}
}