- Back to Home »
- GENERAL OR BASIC PROGRAMS »
- PRIME NUMBERS GENERATION TILL nth term
Posted by : ANIMESH SHAW
Tuesday, 1 May 2012
PRIME
NUMBERS GENERATION TILL nth term:-
/*Program
for Prime Number Generation*/
#include
<stdio.h>
#include
<conio.h>
main()
{
int
n,i=1,j,c;
printf("Enter
Number Of Terms");
printf("Prime
Numbers Are Follwing");
scanf("%d",&n);
while(i<=n)
{
c=0;
for(j=1;j<=i;j++)
{
if(i%j==0)
c++;
}
if(c==2)
printf("%d
",i);
i++;
}
getch();
}

Post a Comment