-
-
Save parzibyte/85e3b9087cb44f6c62d2366a8d07222c to your computer and use it in GitHub Desktop.
This file contains 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
class Main { | |
public static void main(String[] args) { | |
int numero1 = 50, numero2 = 100; | |
System.out.printf("Número 1: %d. Número 2: %d\n", numero1, numero2); | |
int minimo = minimo(numero1, numero2); | |
System.out.printf("Minimo: %d\n", minimo); | |
int maximo = maximo(numero1, numero2); | |
System.out.printf("Máximo: %d\n", maximo); | |
} | |
public static int minimo(int numero1, int numero2) { | |
if (numero1 < numero2) | |
return numero1; | |
// Si no, el mínimo es el número 2 | |
return numero2; | |
} | |
public static int maximo(int numero1, int numero2) { | |
if (numero1 > numero2) | |
return numero1; | |
// Si no, el máximo es el número 2 | |
return numero2; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment