# Python Program to Count trailing zeroes in factorial of a number

PythonServer Side ProgrammingProgramming

#### Beyond Basic Programming - Intermediate Python

Most Popular

36 Lectures 3 hours

#### Practical Machine Learning using Python

Best Seller

91 Lectures 23.5 hours

#### Practical Data Science using Python

22 Lectures 6 hours

In this article, we will learn about the solution to the problem statement given below.

Problem statement − We are given an integer n, we need to count the number of trailing zeros in the factorial.

Now let’s observe the solution in the implementation below −

## Example

Live Demo

# trailing zero
def find(n):
# Initialize count
count = 0
# update Count
i = 5
while (n / i>= 1):
count += int(n / i)
i *= 5
return int(count)
# Driver program
n = 79
print("Count of trailing 0s "+"in",n,"! is", find(n))

## Output

Count of trailing 0s in 79 ! is 18 ## Conclusion

In this article, we have learned about how we can make a Python Program to Count trailing zeroes in factorial of a number