-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArith.java
More file actions
55 lines (54 loc) · 974 Bytes
/
Copy pathArith.java
File metadata and controls
55 lines (54 loc) · 974 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import java.util.Scanner;
class set_value
{
int a,b;
void set_value(int n1,int n2)
{
a=n1;
b=n2;
}
}
class addition extends set_value
{
void add_fn()
{
System.out.println("the addition is:"+(a+b));
}
}
class subraction extends addition
{
void sub_fn()
{
System.out.println(" the sub is"+(a-b));
}
}
class multiple extends subraction
{
void mul_fn()
{
System.out.println("the mul is"+(a*b));
}
}
class divide extends multiple
{
void div_fn()
{
System.out.println(" the div is"+(a/b));
}
}
public class Arith
{
public static void main(String args[]){
int n1,n2;
Scanner sc=new Scanner(System.in);
divide x=new divide();
System.out.println("enter two value");
n1=sc.nextInt();
n2=sc.nextInt();
x.set_value(n1, n2);
x.add_fn();
x.sub_fn();
x.mul_fn();
x.div_fn();
}
}