Program to check prime number

A prime number is a natural number greater then or that cannot be formed by multiplying to smaller natural number. i.e. 3,7,11, etc. are prime number.

Other natural number that are not prime number are called composite number. i.e. 4,6,9, etc. are composite number.

n = int(input("Enter number"))
if n>1:
for i in rang (2,num):
if (n%i)==0:
print(n, "is not a prime number")
print(i,"times", n//i,"is, n)
print(n, "is a prime number")
print(n," is not prime number")

Leave a Reply