aboutsummaryrefslogtreecommitdiff
path: root/challenge-072/lubos-kolouch/python/ch-1.py
blob: c61b1f14bc9068160a561b8f5ccda1df6371b9e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def trailing_zeros(n: int) -> int:
    count = 0
    i = 5
    while n // i >= 1:
        count += n // i
        i *= 5
    return count


# Test cases:
print(trailing_zeros(10))  # Output: 2
print(trailing_zeros(7))  # Output: 1
print(trailing_zeros(4))  # Output: 0