For a given number n count trailing zeroes of n!

For a given number n count trailing zeroes of n!

Fact:
  • Zero comes with 10 and
  • 10 comes with multiplication of 2 and 5 multiples.
  • And 2’s will always be higher than 5 multiple in n!
  • so, count only number of 5.
Algorithm:
  • Iterate number from 5 to n
    • Counter number for 5 occurred

Latest Source Code:
Github: FactorialTrailingZeroesCounter.java


Output:

 
Author: Hrishikesh Mishra