给定一个数,判断其是否为素数
import math def isprime(n) : a=0 # print(n) if int(n)==2 : a = 0 else : # print("i will program this ") for i in range(2,math.ceil(int(n)**0.5+1)) : if int(n)%i==0 : a = 1 if(a): print("It is not a prime !") print('') else : print("It is a prime !") print('') def program(): while(1) : n = input("请输入一个整数:") isprime(n) program()