top of page
Click here to go to the home page of AskTheCode.

Python program to check whether a number is Prime or not

Team ATC

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")


Recent Posts

See All

Comments

Couldn’t Load Comments
It looks like there was a technical problem. Try reconnecting or refreshing the page.
bottom of page