forked from Divyangana-12/Hacktoberfest2021-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cal.java
23 lines (23 loc) · 790 Bytes
/
cal.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
public class cal {
public static void main(String[] args) {
int n1 = Integer.parseInt(args[0]);
int n2 = Integer.parseInt(args[1]);
switch(args[2])
{
case "+" :
System.out.println(n1+" "+args[2]+" "+n2+" = "+(n1+n2));
break;
case "-" :
System.out.println(n1+" "+args[2]+" "+n2+" = "+(n1-n2));
break;
case "*" :
System.out.println(n1+" "+args[2]+" "+ n2+ " = "+ (n1*n2));
break;
case "/" :
System.out.println(n1+" "+args[2]+" "+ n2+ " = "+ (n1/n2));
break;
default:
System.out.println("enter valid operater");
}
}
}