It is failing at the last two requirements. At this point I have tried 50 variations of the code so I am getting lost further. Please help.
package com.codegym.task.task05.task0532;
import static java.lang.Integer.*;
import java.io.*;
/*
Task about algorithms
Write a program that:
1. reads a number N (must be greater than 0) from the console
2. reads N numbers from the console
3. Displays the maximum of the N entered numbers.
Requirements:
1. The program should read the numbers from the keyboard.
2. The program must display a number on the screen.
3. The class must have a public static void main method.
4. Don't add new methods to the Solution class.
5. The program should display the maximum of the N entered numbers.
6. The program should not display anything if N is less than or equal to 0.
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int maximum = MAX_VALUE;
int N = Integer.parseInt(reader.readLine());
//write your code here
int i;
int N2 = 0 ;
for (i = 0; i != N; i++){
N2 = Integer.parseInt(reader.readLine());
maximum = N2;
}
System.out.println(maximum);
}
}