In this post, we will write a program in Python to **check whether the input number is prime or not using while loop.**

## How to write Prime number Program in Python?

- Prime number is a number that is greater than 1 and divided by 1 or itself.
- In other words, prime numbers can’t be divided by other numbers than itself or 1.
- For example- 2, 3, 5, 7, 11, 13, 17, 19, 23…. are the prime numbers.
- Let’s see the prime number program in Python.

In this Python program, we will take an input from the user and check whether the number is prime or not.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
num = int(input("Enter a number ( greater than 1)") f = 0 i = 2 while i <= num / 2: if num % i == 0: f=1 break i=i+1 if f==0: print("The entered number is a PRIME number") else: print("The entered number is not a PRIME number") |

**Output:**

1 2 3 4 |
Enter a number: 19 The entered number is a PRIME number |

may I get an explanation about how each step was done?

If user enter “1” this program will print it as prime number