public static void main(String[] args) throws Exception {
BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
int inputValue;
double average=0;
boolean end=false;
while(!end){
inputValue=Integer.parseInt(reader.readLine());
average=(average+inputValue)/2;
if(inputValue==-1){
end=true;
}
System.out.println(average);
}
}
package pl.codegym.task.task05.task0507;
/*
Średnia arytmetyczna
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
int inputValue;
double average=0;
boolean end=false;
while(!end){
inputValue=Integer.parseInt(reader.readLine());
average=(average+inputValue)/2;
if(inputValue==-1){
end=true;
}
System.out.println(average);
}
}
}