Hi guys, trying to figure out for couple hours, tried with arrays also, but can't figure out my mistake, read other help section questions, but for now can't figure out. Thanks.
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));
int num = Integer.parseInt(reader.readLine());
int maximum=Integer.MIN_VALUE;
if(num>0){
int len = 0;
while(len<num) {
int num2 = Integer.parseInt(reader.readLine());
if(num2>maximum)
maximum = num2;
len=len+1;
}
if(maximum>0)
System.out.println(maximum);
}
}
}