-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
105 lines (90 loc) · 3.31 KB
/
Program.cs
File metadata and controls
105 lines (90 loc) · 3.31 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Calculation
{
class Program
{
void cal(double w, double h)
{
double area = 0.5 * w * h;
Console.WriteLine("\n\tArea of Triangal=" + area);
}
void cal(int w, int h)
{
double area =w * h;
Console.WriteLine("\n\tArea of Rectangal=" + area);
}
void cal(double w)
{
double area = w * w;
Console.WriteLine("\n\tArea of Square=" + area);
}
void cal(int r)
{
double area = 3.14 *r *r;
Console.WriteLine("\n\tArea of Circle=" + area);
}
void cal(float w, float h)
{
float area = w * h;
Console.WriteLine("\n\tArea of Ellips=" + area);
}
static void Main(string[] args)
{
Program p = new Program();
int ch,temp=0;
double num1, num2;
int val1, val2;
float n1,n2;
while (temp == 0)
{
Console.WriteLine("\n1.Triangal \n2.Rectangal \n3.Square \n4.Circle \n5.Ellips \n6.Exit");
Console.Write("\nEnter the choice=");
ch=Convert.ToInt32(Console.ReadLine());
switch (ch)
{
case 1:
Console.Write("\nEnter the Height=");
num1 = Convert.ToDouble(Console.ReadLine());
Console.Write("Enter the Weight=");
num2 = Convert.ToDouble(Console.ReadLine());
p.cal(num1, num2);
break;
case 2:
Console.Write("\nEnter the Height=");
val1 = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter the Weight=");
val2 = Convert.ToInt32(Console.ReadLine());
p.cal(val1, val2);
break;
case 3:
Console.Write("\nEnter the Height=");
num1 = Convert.ToDouble(Console.ReadLine());
p.cal(num1);
break;
case 4:
Console.Write("\nEnter the Radius=");
val1 = Convert.ToInt32(Console.ReadLine());
p.cal(val1);
break;
case 5:
Console.Write("\nEnter the Vertical Radius=");
n1 = (float)Convert.ToDouble(Console.ReadLine());
Console.Write("Enter the Horizontal Radius=");
n2 = (float)Convert.ToDouble(Console.ReadLine());
p.cal(n1, n2);
break;
case 6:
temp = 1;
break;
default:
Console.WriteLine("\nWrong Choice\n");
break;
}
}
}
}
}