Tuesday 8 May 2012

UVa 10195 The Knights Of The Round Table Solution

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

No comments:

Post a Comment