Answer:
import java.util.Scanner;
public class num2 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int count =0;
int total = 0;
System.out.println("Enter the numbers");
int num = in.nextInt();
while(num!=-1){
total = total+num;
count++;
System.out.println("Enter the next number");
num = in.nextInt();
}
//Compute the average
double average = (double) total/count;
//Outputs
System.out.println("Total count of numbers entered "+(count));
System.out.println("Sum of the numbers "+total);
System.out.printf("Average is %.2f ",average);
}
}
Explanation: