Pages

Ads 468x60px

Saturday, 2 June 2012

C Program For PRIME SERIES


C Program For PRIME SERIES



These programs illustrate various programming elements, concepts such
 as using operators, loops, functions, single and double dimensional arrays,
 performing operations on strings, files, pointers etc. Browse the code from
 simple c program to complicated ones you are looking for, every one of them
 is provided with output. C program download with executable files, so that
 you save on your computer and run programs without compiling the source 
code. All programs are made using c programming language and Codeblocks, 
most of these will work under Dev c++ compiler also. Download software you 
need to develop codes. The first program prints "Hello World" on screen.



CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
int r,a,b,c=0;
clrscr();
printf("Enter the n value:");
scanf("%d",&r);
a=1;
while(a<=r)//for(i=1;i<=n;i++)
{
b=1;c=0;
while(b<=a)
{
if(a%b==0)
c=c+1;
b++;
}//end of while
if(c==2)
printf("%d",a);
a++;
}
getch();
}

0 comments:

Post a Comment

Total Pageviews