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);
}