I understand if the N amount is 0 or less but I don't understand why line 20 doesn't satisfy that last requirement.
Any tips? Thanks
package com.codegym.task.task05.task0532;
import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;
/*
Task about algorithms
*/
public class Solution {
public static void main(String[] args) throws Exception {
Scanner scanner = new Scanner(System.in);
int num;
int max = Integer.MIN_VALUE;
//write your code here
int nAmount = scanner.nextInt();
if (nAmount > 0) {
for (int i = nAmount; i > 0; i--) {
num = scanner.nextInt();
if (num > max) {
max = num;
}
}
}
System.out.println(max);
}
}