Skip to content

Instantly share code, notes, and snippets.

@e-tverdokhleb
Created November 13, 2015 06:51
Show Gist options
  • Save e-tverdokhleb/69e77b45386a7089e775 to your computer and use it in GitHub Desktop.
Save e-tverdokhleb/69e77b45386a7089e775 to your computer and use it in GitHub Desktop.
public class Main {
public static void main(String[] args) {
System.out.println(min(11, 12, 3));
}
public static int min(int a, int b, int c) {
int min = a;
if (b < a) {
min = b;
} else if (c < a) {
min = c;
}
return min;
}
}
@liuiv15
Copy link

liuiv15 commented Nov 16, 2015

Что с логикой не все додумали. Для такого варианта вызова: min(1, -12, -33), результат должен быть -33, а у Вас -12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment