Why it doesn't produce maximum
package com.codegym.task.task05.task0532;
import java.io.*;
import java.util.Scanner;
/*
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.
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(reader.readLine());
int maximum=Integer.MIN_VALUE;;
for(int i=0;i<a;i++)
{
Scanner sc = new Scanner(System.in);
int b = sc.nextInt();
if(b>0)
{
maximum = b;
}
}
//write your code here
System.out.println(maximum);
}
}