# Program for trailing zeroes

Andrew Musgrave

Greenhorn

Posts: 8

posted 3 years ago

#include<math.h>

#include<stdio.h>

int main()

{

long i,j[100000],k,l,T,a,n[100000],c,sum=0,m;

scanf("%ld\n", &T);

for(c=1; c<=T; c++)

{

n[c] = 0;

}

for(i=1; i<=T; i++)

{

scanf("%ld", &j[i]);

printf(" \n");

}

for(k=1; k<=T ; k++)

{

for(l=1; j[k]>pow(5,l); l=l+15);

a=l++;

n[k] = j[k];

while(a>0)

{

n[k] = n[k]/pow(5,l);

sum = sum + n[k];

}

n[k] = sum;

}

for(m=1; m<=T; m++)

{

printf("%ld \n", &n[m]);

}

return 0;

}

long pow(long x,long y)

{

if(y==0)

return 1;

else

return(x*pow(x,y-1));

}

Error :Conflicting types for POW

And is the program correct otherwise?

Here is the program statement

Input

There is a single positive integer T on the first line of input (equal to about 100000). It stands for the number of numbers to follow. Then there are T lines, each containing exactly one positive integer number N, 1 <= N <= 1000000000.

Output

For every number N, output a single line containing the single non-negative integer Z(N).

Example

Sample Input:

6

3

60

100

1024

23456

8735373

Sample Output:

0

14

24

253

5861

2183837

#include<stdio.h>

int main()

{

long i,j[100000],k,l,T,a,n[100000],c,sum=0,m;

scanf("%ld\n", &T);

for(c=1; c<=T; c++)

{

n[c] = 0;

}

for(i=1; i<=T; i++)

{

scanf("%ld", &j[i]);

printf(" \n");

}

for(k=1; k<=T ; k++)

{

for(l=1; j[k]>pow(5,l); l=l+15);

a=l++;

n[k] = j[k];

while(a>0)

{

n[k] = n[k]/pow(5,l);

sum = sum + n[k];

}

n[k] = sum;

}

for(m=1; m<=T; m++)

{

printf("%ld \n", &n[m]);

}

return 0;

}

long pow(long x,long y)

{

if(y==0)

return 1;

else

return(x*pow(x,y-1));

}

Error :Conflicting types for POW

And is the program correct otherwise?

Here is the program statement

Input

There is a single positive integer T on the first line of input (equal to about 100000). It stands for the number of numbers to follow. Then there are T lines, each containing exactly one positive integer number N, 1 <= N <= 1000000000.

Output

For every number N, output a single line containing the single non-negative integer Z(N).

Example

Sample Input:

6

3

60

100

1024

23456

8735373

Sample Output:

0

14

24

253

5861

2183837

Andrew Musgrave

Greenhorn

Posts: 8

posted 3 years ago

You could help yourself by doing the following; you are likely to receive

Format your code so as to be readable. There is a feature called CodeTags that should help. Explain what Z(n) is. Your subject hints at something about trailing zeros, but that doesn't help either.

Andrew Musgrave wrote:Please Reply. I know, we have to be patient, but this problem has me bugged since last week.

You could help yourself by doing the following; you are likely to receive

*some*response that way:

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- Antoine de Saint-Exupery