-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalc.java
More file actions
35 lines (28 loc) · 746 Bytes
/
Copy pathcalc.java
File metadata and controls
35 lines (28 loc) · 746 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
29
30
31
32
33
34
35
class calc {
public static void main(String[] args) {
int num1, num2,deci;
num1 = Integer.parseInt(args[0]);
num2 = Integer.parseInt(args[1]);
deci=Integer.parseInt(args[2]);
int output;
switch(deci)
{
case 1:
output = num1 + num2;
break;
case 2:
output = num1 - num2;
break;
case 3:
output = num1 * num2;
break;
case 4:
output = num1 / num2;
break;
default:
System.out.printf("You have entered wrong operator");
return;
}
System.out.println(output);
}
}