Created
October 29, 2014 20:47
-
-
Save OlgaKulikova/a6003fee42bb51abcfbd to your computer and use it in GitHub Desktop.
Минимум четырех чисел (JavaRush)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Solution { | |
public static int min(int a, int b, int c, int d) | |
{ | |
int m2 = min(a, b); | |
if (m2 < c & m2 < d) | |
return m2; | |
if (c < m2 & c < d) | |
return c; | |
if (d < c & d < m2) | |
return d; | |
} | |
public static int min(int a, int b) | |
{ | |
int m1; | |
if (a < b) | |
m1 = a; | |
else | |
m1 = b; | |
return m1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
public static int min(int a, int b, int c, int d)
{
int m2 = min(a, b);
if (m2 < c & m2 < d)
return m2;
if (c < m2 & c < d)
return c;
if (d < c & d < m2)
return d;
return m2;
}