-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day9task2.cs
75 lines (67 loc) · 1.01 KB
/
Day9task2.cs
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System;
abstract class Calculator
{
public abstract void Arithmetic();
}
class Addition:Calculator
{
public override void Arithmetic( )
{
int a=30;
int b=40;
int sum;
Console.WriteLine("ADD");
sum=a+b;
Console.WriteLine(sum);
}
}
class Subtract:Calculator
{
public override void Arithmetic()
{
int c=30;
int d=30;
int sub;
Console.WriteLine("SUB");
sub=d-c;
Console.WriteLine(sub);
}
}
class Multiply:Calculator
{
public override void Arithmetic()
{
int e=30;
int f=50;
int mul;
Console.WriteLine("MUL");
mul=e*f;
Console.WriteLine(mul);
}
}
class Divide:Calculator
{
public override void Arithmetic()
{
int g=30;
int h=40;
int div;
Console.WriteLine("DIV");
div=g/h;
Console.WriteLine(div);
}
}
class task
{
public static void Main()
{
Addition aobj = new Addition();
aobj.Arithmetic();
Subtract sobj = new Subtract();
sobj.Arithmetic();
Multiply mobj = new Multiply();
mobj.Arithmetic();
Divide dobj = new Divide();
dobj.Arithmetic();
}
}