Hi!
If someone is more experienced than me please look at my code and help me figure it out what is going wrong. I mean code is working but I cannot pass the task. The "recommendation from the mentor" is "Be sure that the program works correctly for negative numbers". But I tried it with the negative numbers and it also works for me.
package com.codegym.task.task05.task0532;
import java.io.*;
import static java.lang.Integer.MIN_VALUE;
/*
Task about algorithms
*/
public class Solution {
public static void main(String[] args) throws Exception
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(reader.readLine());
int max = MIN_VALUE;
//write your code here
for(int i = 0; i < N; i++) {
int N2 = Integer.parseInt(reader.readLine());
if (N2 > max)
{
max = N2;
}
}
if(max >= 0)
{
System.out.println(max);
}
}
}