#include <iostream>
#include <conio.h>
#include <math.h>
using namespace std;
int main()
{

int no,counter,counter1,check,sqrtnum;
cout<<"<-----------------------PRIME NO. SERIES------------------------>";
cout<<"\n\n\n\t\t\t INPUT THE VALUE OF N: ";
cin>>no;
cout<<"\n\n THE PRIME NO. SERIES B/W 1 TO "<<no;
cout<<"\n\n";
if(no>2)
cout<<2;
for(counter = 3; counter <= no; counter=counter+2)
{
check = 0;
sqrtnum= (int)sqrt(counter);
//THIS LOOP WILL CHECK A NO TO BE PRIME NO. OR NOT.
for(counter1 = 3; counter1 <=sqrtnum ; counter1=counter1+2)
if(counter%counter1 == 0){
check++; // INCREMENT CHECK IF NO. IS NOT A PRIME NO.
break;
}
if(check == 0)
cout<<" \t"<<counter;
} getch();
return 0;
}