Tuesday, 8 May 2012

UVa 10432 Polygon Inside A Circle Solution

#include<stdio.h>
#include<math.h>
int main()
{
double r,n,ans;
while(scanf("%lf%lf",&r,&n)==2)
    {
    ans=r*r*n/2*sin(2.0*3.1415926535897932384626433832795/n);
    printf("%.3lf\n",ans);
    }
}

2 comments: