Программа все выводит правильно, но проверку не проходит. В чём может быть проблема? Решаю только через if, как идём по курсу, просьба через массив и цикл for не помогать.
package com.javarush.task.task04.task0419;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
Максимум четырех чисел
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader maxNumber = new BufferedReader(new InputStreamReader(System.in));
int max = Integer.parseInt(maxNumber.readLine());
int max1 = Integer.parseInt(maxNumber.readLine());
int max2 = Integer.parseInt(maxNumber.readLine());
int max3 = Integer.parseInt(maxNumber.readLine());
if ( max > max1 && max > max2 && max > max3 )
System.out.println(max);
if ( max1 > max && max1 > max2 && max1 > max3)
System.out.println(max1);
if ( max2 > max && max2 > max1 && max2 > max3)
System.out.println(max2);
if ( max3 > max && max3 > max1 && max3 > max2)
System.out.println(max3);
if ( max == max1 || max == max2 || max == max3)
System.out.println(max);
else if ( max1 == max2 || max1 == max3 )
System.out.println(max1);
else if ( max2 == max3)
System.out.println(max3);
}
}