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
- Maximum number of squares that can fit in a right angle isosceles triangle
- Area of Triangle using Side-Angle-Side (length of two sides and the included angle)
- Nth angle of a Polygon whose initial angle and per angle increment is given
- Maximum number of 2x2 squares that can be fit inside a right isosceles triangle
- Find side of Square which makes minimal area to fit two identical rectangles inside it
- Find other two sides of a right angle triangle
- Find other two sides and angles of a right angle triangle
- Angle subtended by the chord when the angle subtended by another chord of same length is given
- Exterior angle of a cyclic quadrilateral when the opposite interior angle is given
- Angle between a chord and a tangent when angle in the alternate segment is given
- Angle subtended by the chord to center of the circle when the angle subtended by the another equal chord of a congruent circle is given
- Program to calculate angle on circumference subtended by the chord when the central angle subtended by the chord is given
- Find all sides of a right angled triangle from given hypotenuse and area | Set 1
- Check if right triangle possible from given area and hypotenuse
- Number of possible pairs of Hypotenuse and Area to form right angled triangle
- Area of Circumcircle of a Right Angled Triangle
- Area of Incircle of a Right Angled Triangle
- Find the height of a right-angled triangle whose area is X times its base
- Biggest Reuleaux Triangle inscribed within a Square inscribed in an equilateral triangle
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.