Given a right angled triangle with height l, base b & hypotenuse h.We need to find the area of the largest square that can fit in the right angled triangle.
Input: l = 3, b = 4, h = 5 Output: 2.93878 The biggest square that can fit inside is of 1.71428 * 1.71428 dimension Input: l = 5, b = 12, h = 13 Output: 12.4567
Considering the above diagram, we see,tanx = l/b.
Here it is also true that, tanx = a/(b-a).
So, l/b = a/(b-a) which means that, a = (l*b)/(l+b)
Below is the required implementation:
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.
- Biggest Reuleaux Triangle within a Square which is inscribed within a Right angle Triangle
- Area of Triangle using Side-Angle-Side (length of two sides and the included angle)
- Area of the Largest Triangle inscribed in a Hexagon
- Area of largest triangle that can be inscribed within a rectangle
- Area of the Largest square that can be inscribed in an ellipse
- Area of largest semicircle that can be drawn inside a square
- Largest area square in an array when elements can be shuffled
- Area of a square inscribed in a circle which is inscribed in an equilateral triangle
- Largest square that can be inscribed within a hexagon which is inscribed within an equilateral triangle
- Find other two sides of a right angle triangle
- Find other two sides and angles of a right angle triangle
- Maximum number of squares that can fit in a right angle isosceles triangle
- Nth angle of a Polygon whose initial angle and per angle increment is given
- Biggest Reuleaux Triangle inscribed within a Square inscribed in an equilateral triangle
- Area of Reuleaux Triangle
- Area of Incircle of a Right Angled Triangle
- Area of Circumcircle of a Right Angled Triangle
- Program to find area of a triangle
- Check if right triangle possible from given area and hypotenuse
- Find the coordinates of a triangle whose Area = (S / 2)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.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.