-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathLab2.java
More file actions
31 lines (24 loc) · 726 Bytes
/
Lab2.java
File metadata and controls
31 lines (24 loc) · 726 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
import java.util.*;
import java.lang.*;
class Lab2{
public double divide(int a,int b){
//System.out.println("Division is" + (a/b));
double g =((double) a) / b;
return g;
}
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.println("enter 1st value");
int x = sc.nextInt();
System.out.println("enter 2nd value");
int y = sc.nextInt();
Lab2 div = new Lab2();
System.out.println("Division is"+div.divide(x,y));
Addition addition = new Addition();
System.out.println("Addition is"+addition.add(x,y));
Multiply multi = new Multiply();
multi.mul(x,y);
substraction sub = new substraction();
System.out.println("Substraction is"+sub.sub(x,y));
}
}