#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
long n,a[1000],prime,i,j,t,p;
clrscr();
printf("How many prime numbers : ");
scanf("%ld",&n);
p=0;
for(i=2;p<n;i++)
{
prime=1;
t=sqrt(i);
for(j=2;j<=t;j++)
if(i%j==0)
{
prime=0;
break;
}
if(prime==1)
a[p++]=i;
}
for(i=0;i<n;i++)
printf("\n\na[%ld] = %ld",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.........