Python program to check whether a number is Prime or not

Asked: Anonymously |Category: Python

num =eval(input("Enter the number"))

if num > 1:

for i in range(2,num):

if (num % i) == 0:

print(num,"is not a prime number")

print(i,"times",num//i,"is",num)

break

else:

print(num,"is a prime number")

else:

print(num,"is not a prime number")


17 views

Recent Posts

See All

"Believe you can and you're halfway there"