-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalci.java
More file actions
28 lines (25 loc) · 903 Bytes
/
Copy pathcalci.java
File metadata and controls
28 lines (25 loc) · 903 Bytes
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
import java.util.*;
public class calci {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.println("Enter the value of a: ");
int a = sc.nextInt();
System.out.println("Enter the value of b: ");
int b = sc.nextInt();
System.out.println("Enter operation which you want to perform: ");
char ch = sc.next().charAt(0);
switch(ch) {
case '+' : System.out.println(a+b);
break;
case '-' : System.out.println(a-b);
break;
case '*' : System.out.println(a*b);
break;
case '%' : System.out.println(a%b);
break;
case '/' : System.out.println(a/b);
break;
default : System.out.println("wrong choice");
}
}
}