-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEjercicio13.java
executable file
·44 lines (24 loc) · 1.17 KB
/
Ejercicio13.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
public class Ejercicio13 {
public static void main(String[] args) {
System.out.println("Vamos a ordenar tres numeros enteros:");
System.out.println("Introduce el primer numero:");
int num1 = Integer.parseInt(System.console().readLine());
System.out.println("Introduce el segundo numero:");
int num2 = Integer.parseInt(System.console().readLine());
System.out.println("Introduce el tercer numero:");
int num3 = Integer.parseInt(System.console().readLine());
if(num3 > num2 && num2 > num1){
System.out.printf("\n%d > %d > %d", num3, num2, num1);
} else if(num3 > num1 && num1 > num2){
System.out.printf("\n%d > %d > %d", num3, num1, num2);
} else if(num2 > num1 && num1 > num3){
System.out.printf("\n%d > %d > %d", num2, num1, num3);
} else if(num2 > num3 && num3 > num1){
System.out.printf("\n%d > %d > %d", num2, num3, num1);
} else if(num1 > num2 && num2 > num3){
System.out.printf("\n%d > %d > %d", num1, num2, num3);
} else {
System.out.println("Opción no contemplada.");
}
}
}