Saturday, 23 Oct 2021

# Calculate area and height of an isosceles triangle whose sides are radii of a circle

Calculate area and height of an isosceles triangle whose sides are radii of a circle
Given integers R and representing the radius of a circle and the angle formed at the center O by the sector AB (as shown in the figure below), the task is to find the height and area of the triangle formed by connecting the points A, B, and O if possible. Otherwise, print “Not possible”.

Examples:

Input: R = 5,   = 120Output:Height of the triangle is 2.5Area of triangle is 10.8253Explanation: The given area and height can be calculated using the equations:Height =
Area = Input: R = 12,  = 240Output: Not possible

Approach: The given problem can be solved based on the following observations:

Observations:

Suppose a perpendicular is drawn on chord AB from point O and the perpendicular cuts the chord at point D. Then the height of the triangle will be OD.>
According to property of circle the point D divides the chord AB in two equal parts and triangle AOD and BOD will be similar triangle.>
The angles ∠OAB and ∠OBA are also equal as triangle AOD and BOD are similar and is equal to
The height of the triangle OAB can be calculated using the formula:

The area of the triangle can be calculated as:

Follow the steps below to solve the problem:>
Check if the angle is greater than 180 or is equal to 0 then print “Not possible”.
Now convert the angle in radian.
Calculate the angle ∠OAB and ∠OBA as
Now print the height and area of triangle OAB after calculating it using the above-discussed formula.
Below is the implementation of the above approach:>

C++

#include
using namespace std;

double Convert(double degree)
{
double pi = 3.14159265359;
return (degree * (pi / 180));
}

void areaAndHeightOfTraingle(