Thursday, September 18, 2014

UVa Solution 10432 - Polygon Inside A Circle

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
#define PI acos(-1.0)

int main()
{
    double rad, n, area;

    while(scanf("%lf %lf", &rad, &n)==2)
    {
        area = n*(rad*rad)*sin((2*PI)/n)*0.5;
        printf("%0.3lf\n", area);
    }
}

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;     ...