#include<stdio.h>
int main()
{
int i,n,b=5,c,m=0;
long long a;
scanf("%d",&n);
for(i=0;i<n;i++)
{
b=5;
scanf("%ld",&a);
while(b<a){
c=a/b;
b*=5;
m+=c;
}
printf("%d\n",m);
m=0;
}
return 0;
}
You are missing the cases which are powers of 5 such as 25,125,625…
Accepted Submission:http://www.codechef.com/viewsolution/5228425
1 Like