Given here is an equilateral triangle with side length **a**, which inscribes a circle, which in turn inscribes a square. The task is to find the area of this square.

**Examples:**

Input: a = 6 Output: 1 Input: a = 10 Output: 0.527046

**Approach**:

let

rbe the radius of circle,

hence it is the inradius of equilateral triangle, sor = a /(2 * √3)

diagonal of square,d= diameter of circle =2 * r = a/ √3

So, area of square,A = 0.5 * d * d

henceA = (1/2) * (a^2) / (3) = (a^2/6)

Below is the implementation of the above approach:

`// C++ Program to find the area of the square ` `// inscribed within the circle which in turn ` `// is inscribed in an equilateral triangle ` `#include <bits/stdc++.h> ` `using` `namespace` `std; `
` ` `// Function to find the area of the square ` `float` `area(` `float` `a) `
`{ ` ` ` ` ` `// a cannot be negative `
` ` `if` `(a < 0) `
` ` `return` `-1; `
` ` ` ` `// area of the square `
` ` `float` `area = ` `sqrt` `(a) / 6; `
` ` ` ` `return` `area; `
`} ` ` ` `// Driver code ` `int` `main() `
`{ ` ` ` `float` `a = 10; `
` ` `cout << area(a) << endl; `
` ` `return` `0; `
`} ` |

*chevron_right*

*filter_none*

`// Java Program to find the area of the square ` `// inscribed within the circle which in turn ` `// is inscribed in an equilateral triangle ` ` ` `import` `java.io.*; `
` ` `class` `GFG { `
` ` ` ` `// Function to find the area of the square ` `static` `float` `area(` `float` `a) `
`{ ` ` ` ` ` `// a cannot be negative `
` ` `if` `(a < ` `0` `) `
` ` `return` `-` `1` `; `
` ` ` ` `// area of the square `
` ` `float` `area = (` `float` `)Math.sqrt(a) / ` `6` `; `
` ` ` ` `return` `area; `
`} ` ` ` `// Driver code ` ` ` `public` `static` `void` `main (String[] args) { `
` ` `float` `a = ` `10` `; `
` ` `System.out.println( area(a)); `
`// This code is contributed ` `// by inder_verma.. ` ` ` `} `
`} ` |

*chevron_right*

*filter_none*

`# Python3 Program to find the area ` `# of the square inscribed within ` `# the circle which in turn is ` `# inscribed in an equilateral triangle ` ` ` `# import everything from math lib. ` `from` `math ` `import` `*`
` ` `# Function to find the area ` `# of the square ` `def` `area(a): `
` ` ` ` `# a cannot be negative `
` ` `if` `a < ` `0` `: `
` ` `return` `-` `1`
` ` ` ` `# area of the square `
` ` `area ` `=` `sqrt(a) ` `/` `6`
` ` ` ` `return` `area `
` ` `# Driver code ` `if` `__name__ ` `=` `=` `"__main__"` `: `
` ` ` ` `a ` `=` `10`
` ` `print` `(` `round` `(area(a), ` `6` `)) `
` ` `# This code is contributed by ANKITRAI1 ` |

*chevron_right*

*filter_none*

`// C# Program to find the area ` `// of the square inscribed within ` `// the circle which in turn is ` `// inscribed in an equilateral triangle ` `using` `System; `
` ` `class` `GFG `
`{ ` ` ` `// Function to find the area ` `// of the square ` `static` `float` `area(` `float` `a) `
`{ ` ` ` ` ` `// a cannot be negative `
` ` `if` `(a < 0) `
` ` `return` `-1; `
` ` ` ` `// area of the square `
` ` `float` `area = (` `float` `)Math.Sqrt(a) / 6; `
` ` ` ` `return` `area; `
`} ` ` ` `// Driver code ` `public` `static` `void` `Main () `
`{ ` ` ` `float` `a = 10; `
` ` `Console.WriteLine(area(a)); `
`} ` `} ` ` ` `// This code is contributed ` `// by inder_verma ` |

*chevron_right*

*filter_none*

`<?php ` `// PHP Program to find the area ` `// of the square inscribed within ` `// the circle which in turn is ` `// inscribed in an equilateral triangle ` ` ` `// Function to find the ` `// area of the square ` `function` `area(` `$a` `) `
`{ ` ` ` ` ` `// a cannot be negative `
` ` `if` `(` `$a` `< 0) `
` ` `return` `-1; `
` ` ` ` `// area of the square `
` ` `$area` `= sqrt(` `$a` `) / 6; `
` ` ` ` `return` `$area` `; `
`} ` ` ` `// Driver code ` `$a` `= 10; `
`echo` `area(` `$a` `); `
` ` `// This code is contributed ` `// by inder_verma ` `?> ` |

*chevron_right*

*filter_none*

**Output:**

0.527046

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:

- Biggest Reuleaux Triangle inscribed within a Square inscribed in an equilateral triangle
- Area of circle which is inscribed in equilateral triangle
- Largest square that can be inscribed within a hexagon which is inscribed within an equilateral triangle
- Area of Equilateral triangle inscribed in a Circle of radius R
- Area of a square inscribed in a circle which is inscribed in a hexagon
- Area of the circle that has a square and a circle inscribed in it
- Maximum area of rectangle inscribed in an equilateral triangle
- Maximum count of Equilateral Triangles that can be formed within given Equilateral Triangle
- Biggest Square that can be inscribed within an Equilateral triangle
- Area of a circle inscribed in a rectangle which is inscribed in a semicircle
- Area of a triangle inscribed in a rectangle which is inscribed in an ellipse
- Biggest Reuleaux Triangle inscribed within a square which is inscribed within an ellipse
- Biggest Reuleaux Triangle inscribed within a square which is inscribed within a hexagon
- Biggest Reuleaux Triangle within a Square which is inscribed within a Circle
- Biggest Reuleaux Triangle within a Square which is inscribed within a Right angle Triangle
- Largest hexagon that can be inscribed within an equilateral triangle
- Count of distinct rectangles inscribed in an equilateral 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
- Program to calculate area of an Circle inscribed in a Square

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.