n = int(input(“输入一个数”))
i = 2
flag = True
while i <= n - 1:
if n % i == 0:
flag = False
i += 1
if flag:
print("%d是素数" % n)
else:
print("%d不是素数" % n)
05-04
n = int(input(“输入一个数”))
i = 2
flag = True
while i <= n - 1:
if n % i == 0:
flag = False
i += 1
if flag:
print("%d是素数" % n)
else:
print("%d不是素数" % n)