My program works and shows the maximum number of N numbers. Why can't it pass 5th point of the test?
package com.codegym.task.task05.task0532;
import java.io.*;
import java.util.*;
/*
Task about algorithms
*/
public class Solution {
public static void main(String[] args) throws Exception {
Scanner scan = new Scanner(System.in);
int number = scan.nextInt();
if (number > 0)
{
int maximum = number;
for (int loops = number - 1; loops > 0 && scan.hasNextInt(); loops-- )
{
number = scan.nextInt();
maximum = (maximum > number)? maximum : number;
}
System.out.println(maximum);
}
}
}