I'm making a program where you have to find the average to the 10 integers that the user has entered and then get the program to tell me how many numbers the user entered were actually above average and then actually print those numbers. I'm have problems with it telling me what was above average and which numbers they were. Instead after it calculates the average it just keeps giving me something like this in the output
There are 0 numbers above the average Those numbers are: 0
What am I doing wrong?
public class Average {
static Scanner keyboard = new Scanner(System.in);
static int sum = 0, aboveAverage;
static double average;
public static void main(String[] args) {
int[] listOfInt = new int[10];// 10 integers MAX
System.out.println("Enter " + listOfInt.length + " integers: ");
for (int count = 0; count < listOfInt.length; count++) {
listOfInt[count] = keyboard.nextInt();
}
for (int count = 0; count < listOfInt.length; count++) {
sum = sum + listOfInt[count];
}
average = sum / listOfInt.length;// sum divided by 10
System.out.println("Average: " + average);
if (aboveAverage > average);
System.out.println("There are " + aboveAverage+ " numbers above the average");
System.out.println("Those numbers are: " + aboveAverage);
}
}