Python program for checking if Number is prime or not

 flag=0

n=int(input("Enter N : "))

for i in range(2,n,1):

    if n%i==0:

        flag+=1

if flag==0:

    print(n," is prime ")

else:

    print(n," is not prime ")

Comments