public class Solution {
public static int min(int a, int b, int c, int d) {
//write your code here
int m1,m,x;
m1=min(a,b);
m=min(c,d);
x=min(m1,m);
System.out.print(x);
}
public static int min(int a, int b) {
//write your code here
if(a<=b)
{
return a;
}
else
{
return b;
}
Aastha Khanna
Level 5
What is wrong with this code?
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Bupal Junior
21 May 2019, 19:22
public static int min(int a, int b, int c, int d) {
int n, m, x;
n = min(a,b);
m = min(c,d);
x = min(n,m);
return x;
}
public static int min(int a, int b) {
int small;
if ( a < b) {
small = a;
} else {
small = b;
}
return small;
}
0
Denise
21 May 2019, 08:48
The main method already prints the numbers, so you don't need a System.out.print(x) in your first min method. Just a return x;
+4