Alguien sabe porque no se ejecua el programa cuando escribo el numero 2,3,4
Publicado por billgv (6 intervenciones) el 10/01/2018 13:27:47
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package Primeros_Pasos;
import java.util.Scanner;
public class entrenando {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Elige 1 para sumar \n Elige 2 para restar \n Elige 3 para multiplicar \n elige 4 para dividir");
Scanner scanner=new Scanner (System.in);
int eleccion=scanner.nextInt();
if (eleccion==1) {
switch (eleccion) {
case 1:
int suma;
System.out.println("Escriba los numeros que quiere sumar");
suma=scanner.nextInt() + scanner.nextInt();
System.out.println(suma);
break;
}
}
if (eleccion==2) {
switch(eleccion) {
case 1:
System.out.println("Escribe los numeros que quieres restar");
int resta;
resta=scanner.nextInt() - scanner.nextInt();
System.out.println(resta);
break;
};
}
if (eleccion==3) {
switch(eleccion) {
case 1:
System.out.println("Escribe los numeros que quieres multiplicar");
int multiplicacion;
multiplicacion=scanner.nextInt() * scanner.nextInt();
System.out.println(multiplicacion);
break;
case 4:
if (eleccion==4) {
switch(eleccion) {
case 1:
System.out.println("Escribe los numeros que quieres dividir ");
int division;
division=scanner.nextInt() / scanner.nextInt();
System.out.println(division);
}
}
}
}
}
}
Valora esta pregunta
0