I looked through the discussion and help sections first but I still can't catch the error in my code. I didn't assign maximum to 0 and didn't use arrays. It works great with positive and negative values. Does anyone have an idea why I'm failing the last requirement?
package com.codegym.task.task05.task0532;
import java.io.*;
/*
Task about algorithms
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String s = reader.readLine();
int N = Integer.parseInt(s);
int maximum = N;
while( (s = reader.readLine()) != null) {
int current = Integer.parseInt(s);
if (current > maximum) {
maximum = current;
}
}
//write your code here
System.out.println(maximum);
}
}