Given two numbers and as interval range, the task is to find the prime numbers in between this interval.
Input : a = 1, b = 10 Output : 2, 3, 5, 7 Input : a = 10, b = 20 Output : 11, 13, 17, 19
In the below program, the range of numbers is taken as input and stored in the variables ‘a’ and ‘b’. Then using for-loop, the numbers between the interval of a and b are traversed. For each number in the for loop, it is checked if this number is prime or not. If found prime, print the number. Then the next number in the loop is checked, till all numbers are checked.
Enter lower bound of the interval: 1 Enter upper bound of the interval: 10 Prime numbers between 1 and 10 are: 2 3 5 7
- Python program to print all Prime numbers in an Interval
- Program to find sum of prime numbers between 1 to n
- Find two prime numbers with given sum
- Absolute difference between the Product of Non-Prime numbers and Prime numbers of an Array
- Find product of prime numbers between 1 to n
- Find count of Almost Prime numbers from 1 to N
- Find the Product of first N Prime Numbers
- Find two distinct prime numbers with given product
- Find the prime numbers which can written as sum of most consecutive primes
- Absolute Difference between the Sum of Non-Prime numbers and Prime numbers of an Array
- Find the highest occurring digit in prime numbers in a range
- C Program for Find largest prime factor of a number
- C/C++ Program to find Product of unique prime factors of a number
- Print the nearest prime number formed by adding prime numbers to N
- Check if a prime number can be expressed as sum of two Prime Numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.