To find number of zeros in he factorial of numbers.(

#include <stdio.h>
#include<math.h>
int main()
{

long int x,y,z,c=1,sum=0;

scanf("%ld",&x);

for (y=1;y<=x;y++)
{
	scanf("%ld",&z);
	printf("\n");
	long int f;
	do
		{
			f=z/(pow(5,c));
			sum=sum+(long)f;
			c++;
        }
    while(f=0);    
    printf("%ld",sum);
}

return 0;
}

The conditional statement in while should be while(f==0) because while(f=0) means you are assigning the value 0 to f and it will be true.

The errors are:

1.) while(f=0); Shouldn’t this be while(f!=0)
2.) Initialize c to 1 for every test case
3.) Initialize sum to 0 after every test case , because for every test case the sum starts from 0.
4.) “\n” after every output, not before input.

The loop will thus be:

    for (y=1;y<=x;y++)
{
	c=1;
	sum=0;
    scanf("%ld",&z);
    long int f;
    do
        {
            f=z/(pow(5,c));
            sum=sum+(long int)f;
            c++;
        }
    while(f!=0);    
    printf("%ld\n",sum);
}

this is your corrected program :

long int x,y,z,c=1,sum=0;

scanf("%ld",&x);

for (y=1;y<=x;y++)

{

scanf("%ld",&z);

//printf("\n");
sum=0;
c=1;
long int f;
do
    {
        f=z/(pow(5,c));
        sum=sum+f;
        c++;
    }
while(f>0);    
printf("%ld",sum);

}
return 0; }

You missed the \n in the output.