#include <stdio.h>
#include <math.h>
void main()
{
int no,counter,counter1,check,sqrtnum;
printf("<-----------------------PRIME NO. SERIES------------------------>");
printf("\n\n\n\t\t\tINPUT THE VALUE OF N: ");
scanf("%d",&no);
printf("\n\nTHE PRIME NO. SERIES B/W 1 TO %d : \n\n",no);
if(no>2)
printf("%d\t",2);
for(counter = 3; counter <= no; counter=counter+2)
{
check = 0;
//THIS LOOP WILL CHECK A NO TO BE PRIME NO. OR NOT.
sqrtnum= sqrt(counter);
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)
printf("%d\t",counter);
}
}
