# Angle of Polygon

Limits 1s, 512 MB

Nusrat is a brilliant student. She is good at all subjects but only get confused with geometry. Today her teacher gave some homework on geometry and the topic is regular polygon. Given the number of sides of a regular polygon, she needs to find out one of the interior angles of the polygon.

This is a companion discussion topic for the original entry at https://toph.co/p/angle-of-polygon

#include <stdio.h>

int main() {
int i,side,l;
float angle;
scanf("%d",&i);
for(l=0;l<i;l++){
scanf("%d",&side);
angle=side-2;
angle=angle*180;
angle=angle/side;
printf("%f",angle);
}

``````return 0;
``````

}

whatâ€™s wrong with this code???

You have to use T and N as name of varriable

Use typecasting or this equation:- ((1-(2.0/N))*180)

Whatâ€™s the problem here?

#include<stdio.h>
int main()
{
int n,i,t;
double a,b;
scanf("%d",&t);
for(i=1;i<=t;i++){
scanf("%d",&n);
if(n>=3){
b=360/n;
a=(180-b);
printf("%.4lf\n",a);
}
}
return 0;
}

why will this one work but not this one â€ś(180-(360/n))â€ť???

1 Like

thanks to all but I solved the problem without your help 10month ago! (may be)

so thanks to no one

can anyone tell me that how can I take input n, t times?

You can just take input t and put it in a range function of a for loop like this,

``````for t in range(int(input()):
n=int(input())
#code
``````

This will take input n for t times

Same question bro I also tried the same formula.