PRIME NUMBERS USING C
To write a c program to print the prime numbers between 1 to 50.
/*PRIME NUMBERS*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
printf("PRIME NUMBERS");
for(i=0;i<=50;i++)
{
for(j=2;j<=i-1;j++)
{
if((i%j)==0)
goto end;
}
printf("\n\t%d",i);
end:
}
getch();
}
OUTPUT:
PRIME NUMBERS
0
1
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
Comments
Post a Comment