I am stuck at "The min(a, b, c, d) method must return the minimum of the numbers a, b, c, and d", I appreciate any help or idea.
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) {
//write your code here
//int m1;
if(c <= min(a,b) && c <= d)
{
return c;
}
else if (d <= min(a,b) && d <= c)
{
return d;
}
else if (b <= c && b <= d)
{
return b;
}
else
{
return a;
}
//return m1;
}
public static int min(int a, int b) {
//write your code here
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));
}
}