task05.task0507 - Arithmetic mean
This hangs. please advise.
package com.codegym.task.task05.task0507;
/*
Arithmetic mean
*/
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int count = 0;
double total = 0.0;
while (a != -1){
count++;
total = total + a;
}
System.out.println(total/count);
}
}