Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # program to find the trailing zeros in factorial of a given number
- def findZeros(number):
- div = 5
- zeros = 0
- while number >= div:
- quotient = number/div
- zeros += quotient
- div *= 5
- zeros = int(zeros)
- print("The number of trailing zeros in the factorial of " + str(number) + " are " + str(zeros))
- return
- #main function
- cont = True
- while cont:
- number = int(input("Enter the number : "))
- findZeros(number)
- n = int(input("Do you want to continue (1/0): "))
- if n == 0:
- cont = False
- print()
Add Comment
Please, Sign In to add comment