-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddFun2.java
58 lines (53 loc) · 1007 Bytes
/
AddFun2.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import java.util.*;
class AddFun2
{
int Sum(int a,int b){
Scanner s=new Scanner(System.in);
int sum=a+b;
return sum;
}
int Sub(int a,int b){
int sub=a-b;
return sub;
}
int Mul(int a,int b){
int Mul=a*b;
return Mul;
}
int Div(int a,int b){
int Div=a/b;
return Div;
}
public static void main(String args[])
{
Scanner c=new Scanner(System.in);
System.out.println("enter no");
int a=c.nextInt();
System.out.println("enter no");
int b=c.nextInt();
AddFun2 z=new AddFun2();
System.out.println("ENTER 1 FOR SUM 2 FOR SUB 3 FOR MULTI 4 FOR DIV");
int q=c.nextInt();
if(q==1)
{
int f=z.Sum(a,b);
System.out.println("Ans="+f);
}
else if(q==2)
{
int f=z.Sub(a,b);
System.out.println("Ans="+f);
}
else if(q==3)
{
int f=z.Mul(a,b);
System.out.println("Ans="+f);
}
else if(q==4)
{
int f=z.Div(a,b);
System.out.println("Ans="+f);
}
else{System.out.println("ENTER RIGHT CHOICE");}
}
}