Skip to content

Instantly share code, notes, and snippets.

@resovarish
Last active August 7, 2020 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save resovarish/956e0f96e69dd93e256ce03f4afcb202 to your computer and use it in GitHub Desktop.
Save resovarish/956e0f96e69dd93e256ce03f4afcb202 to your computer and use it in GitHub Desktop.
Function that returns the minimum of 4 numbers // Функция, вычисляющая минимум из 4 чисел // Написать функцию, которая вычисляет минимум из четырёх чисел
public static int min4(int a, int b, int c, int d) {
int g = min2(a, b);
int f;
if (g < c) {
if (g < d)
f = g;
else
f = d;
} else {
if (c < d)
f = c;
else
f = d;
}
return f;
}
public static int min2(int a, int b) {
int d;
if (a < b)
d = a;
else
d = b;
return d;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment