-
Notifications
You must be signed in to change notification settings - Fork 82
/
Areas.cs
46 lines (45 loc) · 1.03 KB
/
Areas.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
using System;
namespace Areas
{
class Areas
{
public static double Triangle(double b, double h) {
return (b*h)/2;
}
public static double Rectangle(double b, double h) {
return b*h;
}
public static double Square(double s) {
return s*s;
}
public static double Circle(double r) {
return Math.PI*(r*r);
}
public static double Rhombus(double d1, double d2)
{
return (d1*d2)/2;
}
public static double Rhomboid(double b, double h) {
return b*h;
}
public static double Trapeze(double b1, double b2, double h) {
return ((b1 + b2) / 2) * h;
}
public static double Regular_polygon(double p, double h) {
return (p*h)/2;
}
}
class Program
{
static void Main(string[] args)
{
double b, h, A;
Console.Write("Please write the base of your triangle:");
b = double.Parse(Console.ReadLine());
Console.Write("Please write the height of your triangle:");
h = double.Parse(Console.ReadLine());
A = Areas.Triangle(b, h);
Console.WriteLine("The area of your triangle is: {0}", A);
}
}
}