My code is not working I dont know why>

#include <stdio.h>

int main(void) {
int a,b,factorial=1;
scanf("%d",&a);
for(int i=0;i<a;i++)
{
scanf("%d",&b);
if(b==0)
{
printf(“1\n”);
}
else{
for(int j=1;j<=b;j++)
{
factorial=factorial*j;
}
printf("%d\n",factorial);
factorial=1;
}
}
return 0;
}

First format your code or give link to your submission and give question link. Second, I think overflow is the problem

1 Like

i am new to codechef can u explain me elaborately?

Use ``` (3 backticks) at the start and end of code for formatting. What else you didn’t understood?

2 Likes

should i post here? after applying backticks?

You can edit there also

click on the pencil shaped button on your post, and put 3 backticks at the starting and ending of your code

also share solution link
or just tell me why it is not working (RE/WA/etc…)

in first printf statement you have given wrong quotes they should be “”

That’s just the forums mangling the code, which is why people should always format it :slight_smile:

It even mangled the quotes in your post in the same way XD

1 Like