import java.util.Scanner;
public class JavaApplication35 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter the Scores:");
int total = 0;
int count = 0;
while (true){
int num = scan.nextInt();
if (num == -1){
break;
}
else{
total += num;
count += 1;
}
}
System.out.println("The average is: "+((double)total/count));
}
}
I hope this helps!