Prime Number
####### Prime Number#######
n=int(input("Enter any number:"))
flag=0
i=2
while(i<n):
if n%i==0:
flag=1
break
i=i+1
if flag==1:
print("Not a prime number")
elif n==1:
print("Not a prime number")
else:
print("It is prime number")
or
for i in range(1,101):
k=[]
for j in range(1,i+1):
if i%j==0:
k.append(j)
if len(k)==2:
print(i)
Comments