秋招笔试(其四)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()


上一篇:Java_02 基础学习_注释


下一篇:关于模拟退火matlab的内置函数