-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJAVA44.java
More file actions
24 lines (23 loc) · 923 Bytes
/
Copy pathJAVA44.java
File metadata and controls
24 lines (23 loc) · 923 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
import java.util.Scanner;
public class JAVA44 {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int a=sc.nextInt();
System.out.println("enter a ="+ a);
int b=sc.nextInt();
System.out.println("enter b =" + b);
char operator=sc.next().charAt(0);
System.out.println("enter operator : " + operator);
switch(operator){
case '+' :System.out.println("sum of a and b ="+(a+b));
break;
case '-' :System.out.println("subtract of a and b ="+(a-b));
break;
case '*' :System.out.println("multiply of a and b ="+(a*b));
break;
case '/':System.out.println("divide of a and b ="+(a/b));
break;
default :System.out.println("wrong operator");
}
}
}