判断一个数是不是质数

n = int(input("请输入一个数:"))
if n == 1:
    print("不是质数")
else:
    count = 2
    while count <= n-1:
        if n % count == 0:
            print("不是质数")
            break
        count += 1
    else:
        print("是质数")

 

posted on 2019-04-23 11:20  Little_Raccoon  阅读(242)  评论(0编辑  收藏  举报