秋招笔试(其四)CVTE笔试:求20的阶乘末尾位数为0的个数
作者:互联网
“”"
求出20的阶乘的结果的末尾位数为0的个数
“”"
def num_test():
num = 20
num_jie = 1
num_jie_a = 0
num_jie_b = 0
a = 0
for i in range(1, num):
num_jie = num_jie * i
while (True):
for j in range(1, num):
num_jie_a = num_jie % 10
if num_jie_a == 0:
a += 1
num_jie = int(num_jie // 10)
if num_jie_a != 0:
break
if num_jie <= 0:
break
print(a)
num_test()
标签:10,jie,20,笔试,range,num,阶乘 来源: https://blog.csdn.net/qq_42215669/article/details/119490766