-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.java
35 lines (35 loc) · 837 Bytes
/
menu.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
29
30
31
32
33
34
35
import java.io.*;
class menu
{
public static void main(String[] args) throws IOException{
BufferedReader x=new BufferedReader(new InputStreamReader(System.in));
System.out.print("enter the first number : ");
int a=Integer.parseInt(x.readLine());
System.out.println("enter the second number : ");
int b=Integer.parseInt(x.readLine());
char c=(char)x.read();
int res=0;
switch(c)
{
case '+': res=a+b;
System.out.println("sum : "+res);
break;
case '-': res=a-b;
System.out.println("difference : "+res);
break;
case '*': res=a*b;
System.out.println("product : "+res);
break;
case '/':
if(b==0)
System.out.println("division not possible ");
else
res=a/b;
System.out.println("division : "+res);
break;
default :
System.out.println("wrong imput ");
break;
}
}
}