Мне кажется есть более простое решение задачи, ежели расписывать каждый отдельный случай. Помогите найти.
import java.io.BufferedReader;
import java.io.InputStreamReader;
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 b = Integer.parseInt(reader.readLine());
int c = Integer.parseInt(reader.readLine());
int d = Integer.parseInt(reader.readLine());
int e = Integer.parseInt(reader.readLine());
int minimum = min(a, b, c, d, e);
System.out.println("Minimum = " + minimum);
}
public static int min(int a, int b, int c, int d, int e)
{
if(a<=b && b<=c && c<=d && d<=e)
{
return a;
}
else if(b<=a && a<=c && c<=d && d<=e)
{
return b;
}
else if(c<=b && b<=a && a<=d && d<=e)
{
return c;
}
else if(d<=c && c<=b && b<=a && a<=e)
{
return d;
}
else if(e<=d && d<=c && c<=b && b<=a)
{
return e;
}
return 0;
}
}