factorial in c

my code is running well in code block but it shows wrong in codechef editor why??
here is my code…
#include<stdio.h>
int main()
{int b,n=0,i;
long int T,N;
scanf("%ld",&T);
for(i=1;i<=T;i++)
{scanf("%ld",&N);
n=N;
b=0;
while(n>4){
b=b+n/5;
n=n/5;}
printf("%d",b);}
return 0;}

New line character mate. You need to put each answer or printf in a new line.

Put a new line character in your printf().

1 Like

Your logic is correct but you forgot \n (new line char) while printing output, so it’s returning WA. just replace

printf("%d",b)

with

printf("%d\n",b)

then it should work fine… :slight_smile:

//