This clearly has some problems but I don't know why. I had a look at the while loops in the lessons where they were explained, but can't see the problem.
package com.codegym.task.task05.task0507;
/*
Arithmetic mean
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int number = Integer.parseInt(reader.readLine());
int count = 0;
int total = 0;
double result;
while (number != -1) {
number = Integer.parseInt(reader.readLine());
total += number;
count++;
}
if (count != 0) {
result = total / count;
}
result = 0;
System.out.println(result);
}
}