-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSwitch_Certo.java
More file actions
35 lines (33 loc) · 1.13 KB
/
Switch_Certo.java
File metadata and controls
35 lines (33 loc) · 1.13 KB
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
package Classe_Java;
import java.util.Scanner;
public class Switch_Certo {
public static void main(String[]args){
Scanner entrada = new Scanner(System.in);
int c= 0;
System.out.println("Informe o valor de a:");
int a = entrada.nextInt();
System.out.println("Informe o valor de b:");
int b = entrada.nextInt();
System.out.println("Informe o código, 3, 4 ou 5");
int codigo = entrada.nextInt();
switch (codigo){
case 3:
c=a+b;
System.out.println(c+(c*20)/100);
System.out.println("O resultado é: " + c);
break;
case 4:
c=b-a;
System.out.println(c+(c*20)/100);
System.out.println("O resultado é: " + c);
break;
case 5:
c=a+a;
System.out.println(c+(c*5)/100);
System.out.println("O resultado é: " + c);
break;
default:
System.out.println("Código Inexistente");
}
}
}