Trailing Zeros
Explanation
Here, we are given a number n
and we are required to find out the number of trailing zeros in n!
.
This can be found by counting the number of times 5
appears in the prime factorization of n!
.
And the answer to that is floor(n/5) + floor(n/25) + floor(n/125) + ...
Code
n = int(input())
print(sum(n // (5 ** i) for i in range(1, 14)))