I am stuck that why it is not picking up the value what's wrong in my code
package com.codegym.task.task05.task0507;
/*
Arithmetic mean
*/
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int count=0;
int z =0 ;
while (true)
{
String s = reader.readLine();
int a = Integer.parseInt(s);
count++;
if (a<0)
{
break;
}
else
{
z=z+a;
}
}
System.out.println(z/count);
}
}