Lab#10 Prime number and palindrome

# check weather a number is prime or not
# A prime number is a number that have only two divider: 1 and itself.

p=int(input(“Enter an integer: “))
if p in [0, 1, 4, 6]:
print(p, “is not a prime number!”)
elif p in [2, 3, 5]:
print(p, “is a prime number!”)
else:
p1=p+1
p2=p-1
remainder1=p1%6
remainder2=p2%6
if remainder1==0 or remainder2==0:
print(p, “is a prime number!”)
else:
print(p, “is not a prime number!”)

Leave a Reply

Your email address will not be published.