求100以内的素数的代码

i=2
while(i<100):
    j=2
    while(j<(i/j)):
        if not(i%j):
            break
        j=j+1
    if j>i/j:
        print i,"是素数"
    i=i+1
print "good bye!"

猜你喜欢

转载自blog.csdn.net/wyqwilliam/article/details/82793939