  # Find prime numbers in given range

Hello

In this article, we are going to see how to print all prime numbers between a given range. We have shared code in python language.

## What is Prime number?

Prime number is a number who is divisible by 1 and that number only. There are no factors other than these 2 two.

Example of Prime number: 11,13,29 . All of these numbers do not have factors other than 1 and given number. Prime number can only be odd number.

### How to find whether a number is prime or not?

For a given number, we will check whether a number do not have factor from 2 till square root of the number. We will run a iterative loop and see if there is any number which is factor of that number.

### How to check whether a number is prime through programming

``````import math
def checkPrime(number):
if(number<1):
return False

i=2
while(i<math.sqrt(number)):
if(number%i==0):
return False
break
i+=1

return True

if(number1>number2):
return "Invalid range"
j=number1
while(j<number2+1):
if(checkPrime(j)):