#include<stdio.h>
#include<conio.h>
#include<iostream.h>
#include<math.h>
void main()
{
long n,a[100],t;
clrscr();
cout<<"How many prime numbers : ";
cin>>n;
int p=0;
for(int i=2;p<n;i++)
{
int prime=1;
t=sqrt(i);
for(int j=2;j<=t;j++)
if(i%j==0)
{
prime=0;
break;
}
if(prime==1)
a[p++]=i;
}
for(i=0;i<n;i++)
cout<<"\n\na["<<i+1<<"] = "<<a[i];
getch();
}
///////////////////////////////////////////////////////////////////////////
Copy & paste this code in your TC & run, then you will get output.......
If you have any problem please comment below.........