I checked the code in my computer also for different inputs.
asked 13 Jan '14, 14:15

The question has been closed for the following reason "The question is answered, right answer was accepted" by azimuthal 24 Jan '14, 23:15
Hi, As pointed out by @squal "the number of zeroes increase by 2 for every 5 turns",Solving this problem may come in handy if we follow very interesting property of a prime number and factorials. Since N! = 1X2X3X....X(n1)X(n) so the zeroes come at the end when we encounter pair of 2 and 5.Let us say there are T number of twos in factorising N! and F number of fives. ans we can be pretty sure that T>F as there will obviously be greater number of twos. Hence we need to fing the Power of 5 we get in factorising N!. As I mentioned earlier there is a very interesting property that for any N! the highest power of a prime number 'p' that divides N! can be given by
so here we need to find the highest power of 5 that divide the given factorial. for instance 100 and here k=2 as 5^(2+1)=125>100 so since the highest power is number of zeroes so 24 is number of trailing zeroes in 100!. :) Hope you understood. Happy coding :) answered 13 Jan '14, 17:35

if you look at the factorials carefully:
The trailing zeros increase for the multiples of 5. another thing to be noted is that the value increases by 2 for every 5 turns,(25,50,75...) working solution: http://www.codechef.com/viewsolution/3250906 answered 13 Jan '14, 15:05
