Sunday, February 19, 2012

C Program to find prime numbers below 100 - c programs


C Program to find prime numbers below 100 - c programs


//C Program to find prime numbers below 100
#include <stdio.h>
#include <conio.h>
main()
{
int n;
clrscr();
printf("enter any number");
scanf(%d",&n);
printf(“ PRIME NUMBERS ARE below %d are…: “, n);
for(i=1; i<n; i++)
{
prime = 1;
for(j=2; j<i; j++)
if(i%j == 0)
{
prime = 0;
break;
}
if(prime)
printf(“%d”,n);
}
getch();
}

No comments:

Post a Comment