#include<stdio.h>
main()
{
int
n,np,i,c=0,flag;
clrscr();
printf("\nTotal
number of prime numbers needed\n");
scanf("%d",&np);
n=2;
printf("\n
Following are the Prime Numbers: \n");
while(1)
{
flag=1;
for(i=2;i<=n/2;i++)
{
if(n%i==0)
{
flag=0;
break;
}
}
if(flag==1)
{
c++;
printf("%d\t",n);
}
if(c==np)
break;
n++;
}
getch();
}
Comments
Post a Comment