Home » program to find the area of a Pentagon

program to find the area of a Pentagon

by Online Tutorials Library

Program to find the area of a pentagon

The Pentagon is defined as a polygon which has 5 sides that are equal. The 5 angles present in the Pentagon are also equal. A Pentagon can be divided into 5 similar triangles. The measurement of each interior angle in a regular pentagon 108 degrees.

Program to find the area of a pentagon

The Formula to calculate the area of the Pentagon is,

Program to find the area of a pentagon

Where

s is the side of the Pentagon.
a is the apothem length.

Algorithm

  1. Create variables ‘s’ and ‘a’ and assign its value as 10 and 6.
  2. Create variable area_pentagon equals to (5/2)X(s)X(a) as per the formula of calculating the area of the Pentagon.

Complexity

O(1)


Solution

C Program

Output:

Area of the pentagon=162.5    

PHP Program

Output:

Area of the pentagon=162.5    

Java Program

Output:

Area of the pentagon=162.5  

C# Program

Output:

Area of the pentagon=162.5  

Python Program

Output:

Area of the pentagon=162.5  

Next Topic#

You may also like