Prime number

mail@pastecode.io avatar
unknown
plain_text
a year ago
289 B
2
Indexable
Never
import math

n=int(input("n="))

if n == 2:
    print("n is a prime number")
elif n > 2:
    for i in range (2,int(math.sqrt(n)+1)):
        if n % i != 0:
            print("n is a prime number")
        else:
            print("n is not a prime number")
            break