求1000阶乘中最后0的个数
# -*- coding: utf-8 -*- """ Created on Tue Mar 22 18:10:46 2016 求1000阶乘中最后0的个数 @author: root """ def fun1(): N = 1000 ret = 0; for i in range(1,N+1,1): j=i; while j%5==0: ret=ret+1; j=j/5; print ret def fun2(): N = 1000 ret = 0; while N: ret=ret+N/5; N=N/5; print ret