adsterra

Check whether the number is Prime or not using Python


Check whether the number is Prime  or not using Python



prime number is a number that is divisible only by two numbers itself and one. ... The list of the first ten prime numbers is 2,3,5,7,11,13,17,23,29,31. A number that is not prime is a composite number. A composite number is a number that can be divided by more than two numbers.

Prime.py

num = int(input("Enter a number to Know it is prime or not?"))
for i in range(2,num):
    if num%i==0:
        print("not prime")
        break
else:
    print("prime")

Post a Comment

0 Comments