To check the number is Prime or Not

n=int(raw_input('Enter the number to check:'))
flag=0
i=2
while(i<=(n/2)):
    if (n%i==0):
        flag=1
    i=i+1
if(flag==0):
    print  'The number ',n, ' is prime number'
else:
    print 'The number ',n, ' is not prime number'

No comments: