#include "stdafx.h"
#include <iostream>
#include <conio.h> //For Console Input/Output function like clrscr & getche
usingnamespace std; //Using the "standard" namespace of iostream class
void main()
{
//For Clearing the console screen
int i,j,n,flag, A[10];
cout<<"Enter max. limit:";
cin>>n; //User enters the value of 'n'
for(i=2;i<=n;i++) //Counting starts from '2' as '1' is not a prime number
{
flag=0; //Initializing the Flag variable inside the first for loop, in order to check for(j=2;j<i;j++) //for prime number
{ for (j = 2; j<i ; j++)
if(i%j==0) //Checking for the condition that if, 'i' is fully divided by 'j'
flag++; //If 'i' is fully divided by 'j' then increment the value of 'flag'
}
if(flag==0) //Checking for the condition in which the value of flag is still zero
{ for (int w = 0; w<10; w++)
{A[w] = i; cout<<A[w];}}
}
getche(); //To exit the program after an user's keystroke
}