Не получается разобраться...
package com.javarush.task.task05.task0507;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
Среднее арифметическое
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
int a = 0;
int c = 0;
while(true){
int b = Integer.parseInt(r.readLine());
if(b != -1){
a = (a) + (b);
c++;
}
else if( b == -1){
break;
}
}
double d = a / c;
System.out.println(d);
}
}