# The Knights Of The Round Table

The Knights Of The Round Table

King Arthur is planning to build the round table in a room which has a triangular window in the ceiling. He wants the sun to shine on his round table. In particular, he wants the table to be totally in the sunlight when the sun is directly overhead at noon.

Thus the table must be built in a particular triangular region of the room. Of course, the king wants to build the largest possible table under the circumstances.

As Merlin is out to lunch, write a program which finds the radius of the largest circular table that fits in the sunlit area.

There will be an arbitrary number of test cases, each represented by three real numbers (a, b, and c), which stand for the side lengths of the triangular region. No side length will be greater than 1,000,000, and you may assume that max(a, b, c)<=(a + b + c)/2. You must read until you reach the end of the file.

For each room configuration read, you must print the following line:

The radius of the round table is: r

where r is the radius of the largest round table that fits in the sunlit area, rounded to three decimal digits.

``````12.0 12.0 8.0

``````

``````The radius of the round table is: 2.828

``````

``````#include <stdio.h>
#include <math.h>
int main(){
double a,b,c,p,s,r;
while(scanf("%lf%lf%lf",&a,&b,&c)==3){
if(a==0.0 || b==0.0 || c==0.0)
r=0.0;
else{
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
r=2*s/(a+b+c);
}
printf("The radius of the round table is: %.3lf\n",r);
}
return 0;
}``````

``````#include <stdio.h>
#include <math.h>
int main(){
double a,b,c,p,s,r;
while(scanf("%lf%lf%lf",&a,&b,&c)==3){
if(a==0.0 || b==0.0 || c==0.0)
r=0.0;
else{
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
r=2*s/(a+b+c);
}
printf("The radius of the round table is: %.3lf\n",r);
}
return 0;
}``````