Find the height of a right-angled triangle whose area is X times its base
Given that the area of a right-angled triangle is X times its base b. The task is to find the height of the given triangle.
Input: X = 40
Input: X = 100
Approach: We know that the area of a right-angled triangle, Area = (base * height) / 2 and it is given that this area is X times the base i.e. base * X = (base * height) / 2.
Solving for height, we get height = (2 * base * X) / base = 2 * X.
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Participate in the Scholorship Test for First-Step-to-DSA Course for Class 9 to 12 students.