C++ coding to find prime number between two interval

C++ Program to find Prime number

Hiii friends today i will tell how to make a C++ program which will tell prime number between 2 intervals and if  you don't have knowledge about C++ you can check ...
 So lets start the coding for this is:-
-------------------------------------------------------------------------------------------------------------------------
#include<iostream.h>
void main() 
{
int a,b,i,c;
cout<<"Enter the 1st interval:";
cin>>a;
cout<<"Enter the 2nd interval:";
cin>>b;
 while(a<b)
 {
c=0;
for(i=2;i<=a/2;i++)
{
if(a%i==0)
{
c=1;
break;
}
   }
   if(c==0)
   cout<<"the prime are:"<<a<<endl;
   
++a;
}                                                                               
}                                                                                           
--------------------------------------------------------------------------------------------------------------------------
To download the coding Click on Download icon↴
Image result for download
So this is the coding for the C++ program which will find prime number  between two interval which you will enter ... 

When you will run this Program it will ask 2 number and then it will show prime number between those number.. so when u will run it it will be like this..


and if you want to do more formatting you can edit it...
For more program you can comment below!!


#For more C++ program visit
http://codingrockerzz.blogspot.com/



Comments

Popular posts from this blog

C++ program to find square root of a number

C++ program to find factorial

C++ program to make a Fibonacci Series