Given an integer **A**, which denotes the side of an equilateral triangle, the task is to find the maximum area of the rectangle that can be inscribed in the triangle.

**Examples:**

Input:A = 10

Output:21.65

Explanation:

Maximum area of rectangle inscribed in an equilateral triangle of side 10 is 21.65.

Input:A = 12

Output:31.176

Explanation:

Maximum area of rectangle inscribed in an equilateral triangle of side 12 is 31.176.

**Approach:** The idea is to use the fact that interior angles of an equilateral triangle is 60^{o}. Then, Draw the perpendicular from one of the side of the triangle and compute the sides of the rectangle with the help of below formulae

The length of Rectangle = (Side of Equilateral Triangle)/2

The breadth of Rectangle = sqrt(3) * (Side of Equilateral Triangle)/4

Then, Maximum area of the rectangle will be

Below is the implementation of the above approach:

## C++

`// CPP implementation to find the ` `// maximum area inscribed in an ` `// equilateral triangle ` `#include<bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `// Function to find the maximum area ` `// of the rectangle inscribed in an ` `// equilateral triangle of side S ` `double` `solve(` `int` `s) ` `{ ` ` ` `// Maximum area of the rectangle ` ` ` `// inscribed in an equilateral ` ` ` `// triangle of side S ` ` ` `double` `area = (1.732 * ` `pow` `(s, 2))/8; ` ` ` `return` `area; ` ` ` `} ` ` ` `// Driver Code ` `int` `main() ` `{ ` ` ` `int` `n = 14; ` ` ` `cout << solve(n); ` `} ` ` ` `// This code is contributed by Surendra_Gangwar ` |

*chevron_right*

*filter_none*

## Java

`// Java implementation to find the ` `// maximum area inscribed in an ` `// equilateral triangle ` ` ` `class` `GFG ` `{ ` ` ` `// Function to find the maximum area ` ` ` `// of the rectangle inscribed in an ` ` ` `// equilateral triangle of side S ` ` ` `static` `double` `solve(` `int` `s) ` ` ` `{ ` ` ` `// Maximum area of the rectangle ` ` ` `// inscribed in an equilateral ` ` ` `// triangle of side S ` ` ` `double` `area = (` `1.732` `* Math.pow(s, ` `2` `))/` `8` `; ` ` ` `return` `area; ` ` ` ` ` `} ` ` ` ` ` `// Driver Code ` ` ` `public` `static` `void` `main(String[] args) ` ` ` `{ ` ` ` `int` `n = ` `14` `; ` ` ` `System.out.println(solve(n)); ` ` ` `} ` `} ` ` ` `// This article is contributed by Apurva raj ` |

*chevron_right*

*filter_none*

## Python3

`# Python3 implementation to find the ` `# maximum area inscribed in an ` `# equilateral triangle ` ` ` `# Function to find the maximum area ` `# of the rectangle inscribed in an ` `# equilateral triangle of side S ` `def` `solve(s): ` ` ` ` ` `# Maximum area of the rectangle ` ` ` `# inscribed in an equilateral ` ` ` `# triangle of side S ` ` ` `area ` `=` `(` `1.732` `*` `s` `*` `*` `2` `)` `/` `8` ` ` `return` `area ` ` ` ` ` `# Driver Code ` `if` `__name__` `=` `=` `'__main__'` `: ` ` ` `n ` `=` `14` ` ` `print` `(solve(n)) ` |

*chevron_right*

*filter_none*

## C#

`// C# implementation to find the ` `// maximum area inscribed in an ` `// equilateral triangle ` `using` `System; ` ` ` `class` `GFG ` `{ ` ` ` `// Function to find the maximum area ` ` ` `// of the rectangle inscribed in an ` ` ` `// equilateral triangle of side S ` ` ` `static` `double` `solve(` `int` `s) ` ` ` `{ ` ` ` `// Maximum area of the rectangle ` ` ` `// inscribed in an equilateral ` ` ` `// triangle of side S ` ` ` `double` `area = (1.732 * Math.Pow(s, 2))/8; ` ` ` `return` `area; ` ` ` ` ` `} ` ` ` ` ` `// Driver Code ` ` ` `public` `static` `void` `Main(String[] args) ` ` ` `{ ` ` ` `int` `n = 14; ` ` ` `Console.WriteLine(solve(n)); ` ` ` `} ` `} ` ` ` `// This code is contributed by Rajput-Ji ` |

*chevron_right*

*filter_none*

**Output:**

42.434

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:

- Area of a square inscribed in a circle which is inscribed in an equilateral triangle
- Area of circle which is inscribed in equilateral triangle
- Area of Equilateral triangle inscribed in a Circle of radius R
- Area of a triangle inscribed in a rectangle which is inscribed in an ellipse
- Area of largest triangle that can be inscribed within a rectangle
- Biggest Reuleaux Triangle inscribed within a Square inscribed in an equilateral triangle
- Largest square that can be inscribed within a hexagon which is inscribed within an equilateral triangle
- Area of a circle inscribed in a rectangle which is inscribed in a semicircle
- Biggest Square that can be inscribed within an Equilateral triangle
- Largest hexagon that can be inscribed within an equilateral triangle
- Count of distinct rectangles inscribed in an equilateral triangle
- Ratio of area of a rectangle with the rectangle inscribed in it
- Area of Circumcircle of an Equilateral Triangle using Median
- Program to calculate area and perimeter of equilateral triangle
- Program to calculate area of Circumcircle of an Equilateral Triangle
- Program to calculate the Area and Perimeter of Incircle of an Equilateral Triangle
- Area of the biggest possible rhombus that can be inscribed in a rectangle
- Area of Largest rectangle that can be inscribed in an Ellipse
- Area of the biggest ellipse inscribed within a rectangle
- Area of the Largest Triangle inscribed in a Hexagon

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.