
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Count Trailing Zeroes in Factorial of a Number in Python
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
# 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
Advertisements