Problem Type : Geometry
#include<stdio.h>
#include<math.h>
int main()
{
double a,b,c,s,l,r,m;
while(scanf("%lf%lf%lf",&a,&b,&c)==3)
{
s=(a+b+c)/2;
if(s==0)
{
printf("The radius of the round table is: 0.000\n");
}
else if(s>0)
{
l=(s*(s-a)*(s-b)*(s-c));
r=sqrt(l)/s;
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,s,l,r,m;
while(scanf("%lf%lf%lf",&a,&b,&c)==3)
{
s=(a+b+c)/2;
if(s==0)
{
printf("The radius of the round table is: 0.000\n");
}
else if(s>0)
{
l=(s*(s-a)*(s-b)*(s-c));
r=sqrt(l)/s;
printf("The radius of the round table is: %.3lf\n",r);
}
}
return 0;
}
No comments:
Post a Comment