Given a number, check whether the number is prime or not. If the number is prime , print "Prime" else print "Not Prime"
Input:
5
Output:
Prime
Implementation:
Input:
5
Output:
Prime
Implementation:
#python program to find prime number def checkPrime(n): if n<=1: return False elif n==2 or n==3: return True elif n%2==0 or n%3==0: return False else: i = 5 while i*i<=n: if n%i==0 or n%(i+2)==0: return False i+=6 return True n = int(raw_input()) if checkPrime(n): print "Prime" else: print "Not Prime"