**CHECK FOR A PRIME NUMBER IN PYTHON**

** **

A positive integer greater than 1 which has no other factors except 1 and the number itself is called a prime number. e.g. 2, 3, 5, 7 etc. But 6 is not prime ( it is composite ) since, .

** **

**Program**

# Python program to check if the input number is prime

# take input from the user

num = int(input(“Enter a number: “))

# prime numbers are ≥ 1

if num > 1:

# check for factors

for i in range(2,num):

if (num % i) == 0:

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

print(i,”×”,num//i,”=”,num)

break

else:

print(num,”is a prime number”)

# if input number is ≤ 1, it is not prime

else:

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

input(“Press Enter to Exit”)

** **

**Output**

** **