Hey, I am not getting the "The program should display the maximum of the N entered numbers." checked. Here is my code, the output is correct, I've tried with N being 0 or lower and I don't print anything, which is correct, then I've tested with N being 1 or whatever and added even 0 and I still get the correct output. Please help me figure out what's wrong because I am really confused. Thank you! Below my code:
Scanner scanner = new Scanner(System.in);
int maximum = Integer.MIN_VALUE; //assign to max the lowers int value
int n = scanner.nextInt(); //get n
while(n > 0) { //only go if n > 0
int temp = scanner.nextInt(); //get the next int entered
if(temp > maximum) { //check if it's bigger than our max
maximum = temp; //assign max the new number
}
n--; //decrement n so that we exit while loop after n numbers entered
}
if(maximum > Integer.MIN_VALUE) {
System.out.println(maximum); //only print if max has changed, meaning we entered at least 1 value
}