factorial ques fctrl : this code is running in my system but giving an error here

#include<stdio.h>
int main()
{
unsigned long n,i=0,num=0;
scanf("%lu",&n);
while(n–)
{ i=0;
scanf("%lu",&num);
while(num)
{
i+=num/5;
num/=5;
}
printf("%lu",i);
}
return 0;
}

Make it printf("%lu\n",i); i.e add a “\n” in your printf. rest looks fine

1 Like

Did you test your code? What is the output in your system? Because even with the sample input this code will give wrong answer: you are printing everything on the same line.