Given here is a regular decagon, inscribed within a circle of radius **r**, the task is to find the area of the decagon.

**Examples:**

Input:r = 5Output:160.144Input:r = 8Output:409.969

**Approach**:

We know, side of the decagon within the circle, **a = r√(2-2cos36)**(Refer here)

So, area of the decagon,

A = 5*a^2*(√5+2√5)/2 = 5 *(r√(2-2cos36))^2*(√5+2√5)/2=(5*r^2*(3-√5)*(√5+2√5))/4

Below is the implementation of the above approach:

## C++

`// C++ Program to find the area of the decagon ` `// inscribed within a circle ` `#include <bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `// Function to find the area of the decagon ` `float` `area(` `float` `r) ` `{ ` ` ` ` ` `// radius cannot be negative ` ` ` `if` `(r < 0) ` ` ` `return` `-1; ` ` ` ` ` `// area of the decagon ` ` ` `float` `area = (5 * ` `pow` `(r, 2) * (3 - ` `sqrt` `(5)) ` ` ` `* (` `sqrt` `(5) + (2 * ` `sqrt` `(5)))) ` ` ` `/ 4; ` ` ` `return` `area; ` `} ` ` ` `// Driver code ` `int` `main() ` `{ ` ` ` `float` `r = 8; ` ` ` `cout << area(r) << endl; ` ` ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java Program to find the area of the decagon ` `// inscribed within a circle ` ` ` `import` `java.io.*; ` ` ` `class` `GFG { ` ` ` `// Function to find the area of the decagon ` `static` `double` `area(` `double` `r) ` `{ ` ` ` ` ` `// radius cannot be negative ` ` ` `if` `(r < ` `0` `) ` ` ` `return` `-` `1` `; ` ` ` ` ` `// area of the decagon ` ` ` `double` `area = (` `5` `* Math.pow(r, ` `2` `) * (` `3` `- Math.sqrt(` `5` `)) ` ` ` `* (Math.sqrt(` `5` `) + ((` `2` `* Math.sqrt(` `5` `))))/ ` `4` `); ` ` ` `return` `area; ` `} ` ` ` `// Driver code ` ` ` ` ` `public` `static` `void` `main (String[] args) { ` ` ` `double` `r = ` `8` `; ` ` ` `System.out.println (area(r)); ` ` ` `} ` `//This code is contributed by ajit ` `} ` |

*chevron_right*

*filter_none*

## Python3

`# Python3 Program to find the area of ` `# the decagon inscribed within a circle ` `from` `math ` `import` `sqrt,` `pow` ` ` `# Function to find the ` `# area of the decagon ` `def` `area(r): ` ` ` ` ` `# radius cannot be negative ` ` ` `if` `r < ` `0` `: ` ` ` `return` `-` `1` ` ` ` ` `# area of the decagon ` ` ` `area ` `=` `(` `5` `*` `pow` `(r, ` `2` `) ` `*` `(` `3` `-` `sqrt(` `5` `)) ` `*` ` ` `(sqrt(` `5` `) ` `+` `(` `2` `*` `sqrt(` `5` `))))` `/` `4` ` ` `return` `area ` ` ` `# Driver code ` `if` `__name__ ` `=` `=` `'__main__'` `: ` ` ` `r ` `=` `8` ` ` `print` `(area(r)) ` ` ` `# This code is contributed ` `# by Surendra_Gangwar ` |

*chevron_right*

*filter_none*

## C#

`// C# Program to find the area of the ` `// decagon inscribed within a circle ` `using` `System; ` ` ` `class` `GFG ` `{ ` ` ` `// Function to find the area ` `// of the decagon ` `static` `double` `area(` `double` `r) ` `{ ` ` ` ` ` `// radius cannot be negative ` ` ` `if` `(r < 0) ` ` ` `return` `-1; ` ` ` ` ` `// area of the decagon ` ` ` `double` `area = (5 * Math.Pow(r, 2) * ` ` ` `(3 - Math.Sqrt(5)) * ` ` ` `(Math.Sqrt(5) + ` ` ` `((2 * Math.Sqrt(5))))/ 4); ` ` ` `return` `area; ` `} ` ` ` `// Driver code ` `static` `public` `void` `Main () ` `{ ` ` ` `double` `r = 8; ` ` ` `Console.WriteLine (area(r)); ` `} ` `} ` ` ` `// This code is contributed by akt_mit ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP Program to find the area ` `// of the decagon inscribed within ` `// a circle ` ` ` `// Function to find the area ` `// of the decagon ` `function` `area(` `$r` `) ` `{ ` ` ` ` ` `// radius cannot be negative ` ` ` `if` `(` `$r` `< 0) ` ` ` `return` `-1; ` ` ` ` ` `// area of the decagon ` ` ` `$area` `= (5 * pow(` `$r` `, 2) * (3 - sqrt(5)) * ` ` ` `(sqrt(5) + (2 * sqrt(5)))) / 4; ` ` ` `return` `$area` `; ` `} ` ` ` `// Driver code ` `$r` `= 8; ` `echo` `area(` `$r` `) . ` `"\n"` `; ` ` ` `// This code is contributed ` `// by Akanksha Rai(Abby_akku) ` `?> ` |

*chevron_right*

*filter_none*

**Output:**

409.969

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- Largest square that can be inscribed within a hexagon which is inscribed within an equilateral triangle
- Largest right circular cylinder that can be inscribed within a cone which is in turn inscribed within a cube
- Biggest Reuleaux Triangle inscribed within a square which is inscribed within an ellipse
- Largest right circular cone that can be inscribed within a sphere which is inscribed within a cube
- Biggest Reuleaux Triangle inscribed within a square which is inscribed within a hexagon
- Largest sphere that can be inscribed within a cube which is in turn inscribed within a right circular cone
- Largest ellipse that can be inscribed within a rectangle which in turn is inscribed within a semicircle
- Biggest Reuleaux Triangle within a Square which is inscribed within a Circle
- Area of a square inscribed in a circle which is inscribed in an equilateral triangle
- Area of a circle inscribed in a rectangle which is inscribed in a semicircle
- Area of a square inscribed in a circle which is inscribed in a hexagon
- Area of circle inscribed within rhombus
- Area of the circle that has a square and a circle inscribed in it
- Biggest Reuleaux Triangle inscribed within a Square inscribed in an equilateral triangle
- Biggest Reuleaux Triangle within a Square which is inscribed within a Right angle Triangle
- Find area of the larger circle when radius of the smaller circle and difference in the area is given
- Radius of the biggest possible circle inscribed in rhombus which in turn is inscribed in a rectangle
- Radii of the three tangent circles of equal radius which are inscribed within a circle of given radius
- Radius of the inscribed circle within three tangent circles
- Area of a triangle inscribed in a rectangle which is inscribed in an ellipse

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.