public static int min(int a, int b) {
//write your code here
int s;
if (a < b)
s = a;
else
s = b;
}
How do I call the value of the function min(int a, int b) in the method min(int a, int b, int c, int d) ? I want the value 's' in the min(int a, int b, int c, int d) method for comparison.
Resolved
Comments (3)
- Popular
- New
- Old
You must be signed in to leave a comment
Dusernajder
19 April 2019, 12:12
First of all you have to return the value 's', you call it as you would in the main method.
For instance:
public static int min(int a, int b, int c, int d){
if (min(a, b) < min(c, d)){
return min(a, b);
}
}
0
Dorian
19 April 2019, 12:37
Thank you! It worked!!
0
Dusernajder
19 April 2019, 12:42
You are welcome :D
0