C Program to generate prime numbers between two numbers | prime numbers between n1 and n2
What is prime Number and C program to Check given number is Prime or Not,
Check given Number is Prime or not Using Square Root(sqrt) Function.(Efficient way).
Now we will discuss about c program to generate prime numbers between two numbers.
This program accept two integers from user and and generates all prime numbers between those two Numbers. here i am using two loops one is Outer loop and second one is Inner loop. outer loop will starts with n1( first number of user) and ends with n2 (user’s second number ). Inner loop is normal prime number logic loop starts with 2 and ends with n/2 (you can use sqrt(n) ).
|Output of Prime number between two numbers program|