C# Program to calculate area of pentagon
Program
using System;
namespace area_of_pentagon
{
class AreaOfPentagon
{
static void Main(String[] args)
{
int apothem, side;
float area, area_num;
Console.Write("Enter the apothem:\t");
apothem = int.Parse(Console.ReadLine());
Console.Write("Enter the length of side:\t");
side = int.Parse(Console.ReadLine());
area_num = (5 * side * apothem);
area = area_num / 2;
Console.WriteLine("Area of pentagon: " + area);
}
}
}
Output
$ mcs AreaOfPentagon.cs
$ mono AreaOfPentagon.exe
Enter the apothem: 7
Enter the length of side: 15
Area of pentagon: 262.5