Page

Code for PRIME SERIES in c language

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

No comments:

Post a Comment