Tuesday, March 30, 2010

Lets do Math !! Fun !!

Objective : Finding the number of zeros in factorial(n).
Complexity : Want to calculate it without calculating the factorial.


Post your answers Guys!










Concept : We need to count how many 0's we can generate by multiplication of 5 with even number.

Here is the answer : http://www.purplemath.com/modules/factzero.htm
Thanks geeksforgeeks for the coding solution.
http://www.geeksforgeeks.org/count-trailing-zeroes-factorial-number/


In any case, if you have better approach or you want to discuss, post your queries.