Write a program that displays first n prime numbers.

#include<stdio.h>
#include<conio.h>
#include<math.h>

void main()
{
    int n,i,j,p,t,k=0;
    clrscr();
    printf("Enter 1st number, n = ");
    scanf("%d",&n);

    for(i=2;k<n;i++)
    {
       p=1;
       t=sqrt(i);

       for(j=2;j<=t;j++)
          if(i%j==0)
          {
             p=0;
         break;
          }
       if(p==1)
       {
          printf("%8d",i);
          k++;
       }
    }

    getch();
}

///////////////////////////////////////////////////////////////////////////
Copy & paste this code in your TC & run, then you will get output.......
If you have any problem please comment below.........