Wednesday, May 1, 2019

RADIUS OF THE CIRCLE

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

CODING ARENA::

#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;
}

    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

No comments:

Post a Comment

Parity

Problem Description Ram and Sita playing the parity game. Two types of parity are there. One is odd parity and next is even parity. Ram will...