#include<iostream>
using namespace std;
void main()
{
int num1,num2,i,x,prime;
cout<<"Enter the two values between which series is to be generated:";
cin>>num1>>num2;
{for(i=num1;i<=num2;i++)
{
prime=0;
for(x=2;x<=i/2;x++)
{
if(i%x==0)
{prime=1;
break;
}
}
if(prime==0)
cout<<" "<<i;
}
}
system("PAUSE");
}
No comments:
Post a Comment