1# Program to check if a number is prime or not
2
3num = 29
4
5# To take input from the user
6#num = int(input("Enter a number: "))
7
8# define a flag variable
9flag = False
10
11# prime numbers are greater than 1
12if num > 1:
13 # check for factors
14 for i in range(2, num):
15 if (num % i) == 0:
16 # if factor is found, set flag to True
17 flag = True
18 # break out of loop
19 break
20
21# check if flag is True
22if flag:
23 print(num, "is not a prime number")
24else:
25 print(num, "is a prime number")