-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitch_csee_statement.java
More file actions
43 lines (40 loc) · 1.5 KB
/
Copy pathswitch_csee_statement.java
File metadata and controls
43 lines (40 loc) · 1.5 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
36
37
38
39
40
41
42
43
package basicjava_pac;
import java.util.*;
public class switch_csee_statement {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a, c;
System.out.println("Enter any two Number");
a = sc.nextInt();
c = sc.nextInt();
int b,s;
do{
System.out.println(
"If you want to add then prass 1, if you want to subtraction then prass 2 , if you want to multification then tenn press 4 and if you want to divisen then press 5");
b = sc.nextInt();
switch (b) {
case 1:
System.out.printf("Sum Of %d and %d Is = %d ", a, c, a + c);
break;
case 2:
System.out.printf("Subtarction Of %d and %d Is = %d ", a, c, a - c);
break;
case 4:
System.out.printf("Multiplication Of %d and %d Is = %d ", a, c, a * c);
break;
case 5:
if (c != 0) {
System.out.printf("Divition Of %d and %d Is = %d ", a, c, a / c);
} else {
System.out.println("Divition is not possible");
}
break;
default:
System.out.println("Enter the Right valu");
break;
}
System.out.println("\nTo continue the loop is enter 8 and exit the loop");
s=sc.nextInt();
}while(s==8);
}
}