Angle of Polygon

Nusrat is a brilliant student. She is good at all subjects but only get confused with geometry. Toda…

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

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