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();
}

Popular Post

Blog Archive

Total Pageviews

Sign In

Follow by Email

Powered by Blogger.

Like Us on Facebook

Search This Blog

Loading...

Indian Coder

- Copyright © Programming Mania -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -