#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<iostream.h>
void main()
{
int n,k=0;
clrscr();
cout<<"Enter 1st number, n = ";
cin>>n;
for(int i=2;i<=n;i++)
{
int p=1;
int t=sqrt(i);
for(int j=2;j<=t;j++)
if(i%j==0)
{
p=0;
break;
}
if(p==1)
{
cout<<i;
k++;
}
}
}
///////////////////////////////////////////////////////////////////////////
Copy & paste this code in your TC & run, then you will get output.......
If you have any problem please comment below.........