-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicCal.java
More file actions
41 lines (32 loc) · 1.04 KB
/
BasicCal.java
File metadata and controls
41 lines (32 loc) · 1.04 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.Scanner;
public class BasicCal {
public static void main(String[] args) {
int cal;
Scanner num = new Scanner(System.in);
System.out.println("enter the number 1");
int n1 = num.nextInt();
System.out.println("enter the number 2");
int n2 = num.nextInt();
System.out.println("select operetor");
System.out.println("Addition=1 Substraction:2 Division:3 Multipilcation :4");
int op = num.nextInt();
switch (op) {
case 1:
cal = n1 + n2;
System.out.println("Addition=" + cal);
break;
case 2:
cal = n1 - n2;
System.out.println("Substractio " + cal);
break;
case 3:
cal = n1 / n2;
System.out.println("Division " + cal);
break;
case 4:
cal = n1 * n2;
System.out.println("Multiplication " + cal);
break;
}
}
}