what's wrong in my code for factorial question?

#include<stdio.h>
int main()
{
long int T,i;
scanf("%ld",&T);
int a[100000];
for(i=0;i<T;i++)
{
scanf("%d",a[i]);
}
for(i=0;i<T;i++)
{
printf("%ld\n",a[i]/5);
}return 0;
}

the RE that u r getting is due to the wrong use of scanf…it should be:-

scanf("%d",&a[i]);

also rethink on ur logic…:slight_smile:

1 Like

why did you divide by 5?

for example 6! has 1 zero and 10! has 2 zeros.Bcz we had 1 multiple of 5 in 6! and 2 multiples of 5 in 10!.Since we can have 2 multiples of 2 for every multiple of 5 we can get a 10 with one multiple of 5.

with this logic see if u r getting the correct ans for 100…by ur logic it should be 20…but the ans is 24…see the sample test cases…:slight_smile:

//