RADIUS OF THE CIRCLE

Description:

Madhan is handling mathematics to 8th grade. He taught area and perimeter of geometric shapes to his students. He thought to give a test based on triangle and circles.The task is to calculate radius of the circle that is inscribed in triangle given the three sides of the triangle. He has set 20 questions and he is tired of preparing answer keys.Write a program to find the radius of the circle inscribed in a triangle. Input and Output Format : Input consists of three integers a, b and c. The three integer corresponds to three sides of a triangle Test Case 1 Input (stdin) 12 11 7 Expected Output Radius=2.53 Test Case 2 Input (stdin) 7 4 5 Expected Output Radius=1.22

Program :


#include <stdio.h>

#include<math.h>

int main()

{

  int a,b,c;

  scanf("%d%d%d",&a,&b,&c);

  double radius;

  float s=((a+b+c)*1.0)/2.0;

  radius=sqrt((s-a)*(s-b)*(s-c)/s);

  printf("Radius=%.2f",radius);

 


            return 0;

}