Below you see my code. It works and I get the correct result but codegym is apparently looking for something different. Could someone give me a hint?
Thanks in advance.
package com.codegym.task.task02.task0217;
/*
Minimum of four numbers
*/
public class Solution {
public static int min(int a, int b, int c, int d) {
int e = 0;
int f = 0;
int h = 0;
if (a <= b && a <= c && a <=d)
e = a;
else if (b <= c && b <= d && b <= a)
e = b;
else if (c <= a && c <= b && c <= d)
f = c;
else
f = d;
h = min(e, f);
return h;
}
public static int min(int a, int b) {
int g = 0;
if (a <= b)
g = a;
else
g = b;
return g;
}
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));
}
}