#include <stdio.h>
#include <stdlib.h>
int count0(int N)
{
int i;
int j;
int count = 0;
for(i=5;i<=N;i+=5)
{
j = i;
while(j>0 && j%5==0)
{
j = j/5;
count++;
}
}
return count;
}
int main(int argc, char *argv[])
{
int N;
printf("Please input the number you want to count:\n");
scanf("%d",&N);
printf("%d! has %d zeros\n", N, count0(N));
system("PAUSE");
return 0;
}
|