forked from kant003/JavaPracticeHacktoberfest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNainIglesias.java
98 lines (60 loc) · 1.82 KB
/
NainIglesias.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import java.util.Scanner;
public class NainIglesias {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
try{
int respuesta = 0;
int sumando = 0;
int sumador = 0;
int total = 0;
int restador = 0;
int restado = 0;
int divisor = 0;
int dividendo = 0;
int cociente = 0;
int resto = 0;
int multiplicador = 0;
int multiplicando = 0;
System.out.println("Que quieres hacer?" + "1 Sumar" + "2 Restar" + "3 Dividir" + "4 Multiplicar");
respuesta = sc.nextInt();
if (respuesta == 1) {
System.out.println("Primer sumador:");
sumador = sc.nextInt();
System.out.println("Segundo sumador: ");
sumando = sc.nextInt();
total = sumador + sumando;
System.out.println("Respuesta: " + total);
}
else if (respuesta == 2) {
System.out.println("Primer restador:");
restador = sc.nextInt();
System.out.println("Segundo restador: ");
restado = sc.nextInt();
total = restador - restado;
System.out.println("Respuesta: " + total);
}
else if (respuesta == 3) {
System.out.println("Primer divisor:");
divisor = sc.nextInt();
System.out.println("Primer dividendo : ");
dividendo = sc.nextInt();
cociente = divisor / dividendo;
resto = divisor % dividendo;
System.out.println(divisor + "/" + dividendo + " da como cociente " + cociente + " y de resto " + resto);
} else if (respuesta == 4) {
System.out.println("Primer multiplicador:");
multiplicador = sc.nextInt();
System.out.println("Segundo multiplicando : ");
multiplicando = sc.nextInt();
total = multiplicador * multiplicando;
System.out.println("Total de la multiplicación: " + total);
}
else {
System.out.println("Bro no se que es eso intentalo con otro número anda");
}
}
finally {
sc.close();
}
}
}