-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSwich.java
More file actions
41 lines (39 loc) · 1.17 KB
/
Swich.java
File metadata and controls
41 lines (39 loc) · 1.17 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
import java.util.*;
public class Swich {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.print("Enter a:");
int a = sc.nextInt();
System.out.println();
System.out.print("Enter b:");
int b = sc.nextInt();
System.out.println();
System.out.print("Enter your choice:");
int ch =sc.nextInt();;
switch(ch){
case 1:
int sum = a+b;
System.out.println("Sum is"+sum);
break;
case 2:
int sub = a-b;
System.out.println("Subtraction is"+sub);
break;
case 3:
int mul = a*b;
System.out.println(" Multiplication is"+mul);
break;
case 4:
int div = a/b;
System.out.println(" Division is"+div);
break;
case 5:
int rem = a%b;
System.out.println(" Reminder is"+rem);
break;
default:
System.out.println("--Wrong Input--" );
break;
}
}
}