N!에서 뒤에서부터 처음 0이 아닌 숫자가 나올 때까지 0의 개수를 구하는 프로그램을 작성하시오.
첫째 줄에 N이 주어진다. (0 ≤ N ≤ 500)
첫째 줄에 구한 0의 개수를 출력한다.
n = int(input())
total = 1
for num in range(2, n+1):
total *= num
number = str(total)[::-1]
cnt = 0
for i in number:
if i != '0':
break
cnt += 1
print(cnt)
(2x5)
가 곱해지는 순간이다.n=int(input());print(n//125+n//25+n//5)