Note: (Restricted functionality due to obvious reasons!)
Minimal Code ( Raw-View ) :
#include<iostream.h>
#include<conio.h>
void main()
{
int i,n,x;
cout<<"Enter the last number : ";
cin>>x;
for(i=2; i<=x; i++)
{
for(n=2; n<=i; n++)
{
if(i%n==0){break;}
if(n==i-1){cout<<i<<" ";}
}
}
}