I think the issue is that the code should not work at all if the number of digits is more than N but mine still works. Am I correct with this assumption? I was trying to fix it but was looking at it for too long now. Need a fresh look and a hint, please.
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 count = 1;
int maximum = N;
while (count < N) {
int n = Integer.parseInt(reader.readLine());
if (n > maximum) {
maximum = n;
}
count++;
}
//write your code here
System.out.println(maximum);
}
}