Area of Incircle of a Right Angled Triangle in C Program?


To find the area of a circle inside a right angled triangle, we have the formula to find the radius of the right angled triangle, r = ( P + B – H ) / 2.

Given the P, B and H are the perpendicular, base and hypotenuse respectively of a right angled triangle.

Area of a circle is given by the formula,

Area = π*r2

where π = 22 / 7 or 3.14 and r is the radius of the circle.

Hence the area of the incircle will be given by the formula,

Area = π* ((P + B – H) / 2)2.

Example

#include
#define PI 3.14159265
int main() {
   float area,P = 3, B = 4, H = 5;
   area=(P + B - H) * (P + B - H) * (PI / 4);
   printf("Area = %f", area);
   return 0;
}

Output

Area = 3.141593
raja
Published on 09-Aug-2019 09:58:56
Advertisements