public class Solution {
public static int min(int a, int b, int c, int d) {
if (a<=b && a<=c && a<=d)
return a;
else if (b<=a && b<=c && b<=d)
return b;
else if (c<=a && c<=b && c<=d)
return c;
else //(d<=a && d<=b && d<=c)
return d;
}
public static int min(int a, int b) {
if (a<=b)
return a;
else
return b;
}
package pl.codegym.task.task02.task0217;
/*
Najmniejsza z czterech liczb
*/
public class Solution {
public static int min(int a, int b, int c, int d) {
if (a<=b && a<=c && a<=d)
return a;
else if (b<=a && b<=c && b<=d)
return b;
else if (c<=a && c<=b && c<=d)
return c;
else //(d<=a && d<=b && d<=c)
return d;
}
public static int min(int a, int b) {
if (a<=b)
return a;
else
return b;
}
public static void main(String[] args) throws Exception {
System.out.println(min(-20, -10));
System.out.println(min(-20, -10, -30, -40));
System.out.println(min(-20, -10, -30, 40));
System.out.println(min(-40, -10, -30, 40));
}
}