number of trailing zeros in factorial python

Solutions on MaxInterview for number of trailing zeros in factorial python by the best coders in the world

showing results for - "number of trailing zeros in factorial python"
Basile
10 Jul 2016
1def findTrailingZeros(n):
2 
3    # Initialize result
4    count = 0
5 
6    # Keep dividing n by
7    # 5 & update Count
8    while(n >= 5):
9        n //= 5
10        count += n
11 
12    return count
13 
14 
15# Driver program
16n = 100
17print("Count of trailing 0s " +
18      "in 100! is", findTrailingZeros(n))