forked from 790hanu/Annex-qr-code-simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
calculator.java
28 lines (25 loc) · 897 Bytes
/
calculator.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
import java.util.*;
public class calculator {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter a = ");
int a =sc.nextInt();
System.out.println("Enter operator = ");
char operator = sc.next().charAt(0);
System.out.println("Enter b = ");
int b= sc.nextInt();
switch(operator) {
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("Calculator not that advance");
}
}
}