Given the side of a Pentagon, the task is to find the area of the Pentagon.
Examples:
Input : a = 5
Output: Area of Pentagon: 43.0119
Input : a = 10
Output: Area of Pentagon: 172.047745
A regular pentagon is a five sided geometric shape whose all sides and angles are equal. Its interior angles are of 108 degrees each and its exterior angles are 72 degrees each. The sum of interior angles of a pentagon is 540 degrees.

Let a be the side of Pentagon, then the formula to find the area of Pentagon given by
Area = 
C++
#include<bits/stdc++.h>
using namespace std;
float findArea( float a)
{
float area;
area = ( sqrt (5 * (5 + 2 * ( sqrt (5)))) * a * a) / 4;
return area;
}
int main()
{
float a = 5;
cout << "Area of Pentagon: " << findArea(a);
return 0;
}
|
Java
import java.io.*;
class GFG {
static float findArea( float a)
{
float area;
area = ( float )(Math.sqrt( 5 * ( 5 + 2
* (Math.sqrt( 5 )))) * a * a) / 4 ;
return area;
}
public static void main (String[] args)
{
float a = 5 ;
System.out.println( "Area of Pentagon: "
+ findArea(a));
}
}
|
Python3
from math import sqrt
def findArea(a):
area = (sqrt( 5 * ( 5 + 2 *
(sqrt( 5 )))) * a * a) / 4
return area
a = 5
print ( "Area of Pentagon: " ,
findArea(a))
|
C#
using System;
class GFG
{
static float findArea( float a)
{
float area;
area = ( float )(Math.Sqrt(5 * (5 + 2 *
(Math.Sqrt(5)))) *
a * a) / 4;
return area;
}
public static void Main ()
{
float a = 5;
Console.WriteLine( "Area of Pentagon: " +
findArea(a));
}
}
|
PHP
<?php
function findArea( $a )
{
$area ;
$area = (sqrt(5 * (5 + 2 *
(sqrt(5)))) * $a *
$a ) / 4;
return $area ;
}
$a = 5;
echo "Area of Pentagon: " ,
findArea( $a );
?>
|
Javascript
<script>
function findArea(a)
{
let area;
area = (Math.sqrt(5 * (5 + 2 * (Math.sqrt(5)))) * a * a) / 4;
return area;
}
let a = 5;
document.write( "Area of Pentagon: " + findArea(a));
</script>
|
Output: Area of Pentagon: 43.0119
Time complexity: O(1)
Auxiliary Space: O(1), since no extra space has been taken.