Tuesday, September 16, 2014

UVa Solution 10195 - The Knights Of The Round Table

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;

int main()
{
    double  a, b, c;
    double rad, s, v;
    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");
             continue;
        }
        s = (a+b+c)/2;
        v = sqrt(s*(s-a)*(s-b)*(s-c));
        rad = (v/s);
        printf("The radius of the round table is: %0.3lf\n", rad);
    }
}

No comments:

Post a Comment

Compare equality of two string in C

#include <stdio.h> #include<string.h> int main() {     char* country = "Bangladesh";     char* country2;     ...