#include <iostream>
using namespace std;
class primenum
{
public :
int n1,n2,n;
void inputs ()
{
cout <<"Enter the range ..... to..... : ";
cin >>n1>>n2;
cout <<n1<<"\t"<<n2<<endl;
cout <<"From "<<n1<<" to "<<n2<<" prime numbers are:"<<endl;
}
void display ();
};
void primenum::display ()
{
for (int i=n1;i<n2;i++)
{
n=0;
for (int j=1;j<=i;j++)
{
if (i%j==0)
{
++n;
}
}
if (n==1||n==2)
{
cout <<i<<"\t";
}
}
}
int main() {
primenum p;
p. inputs();
p. display ();
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: