Thursday, 8 November 2012

Check Given Number is Prime or Not?


# This is the second method to check the given number is Prime Number or Not?

count=0
num=input('Enter Any +ve Integer: ')
for i in range(1,num+1/2):
    if num%i==0:
        count=count+1
if count==1:
    print num , 'is Prime Number....'
else:
    print num, 'is Not Prime Number.....'

No comments:

Post a Comment