#include <stdio.h>
#include <math.h>
#define MAX 25
main()
{
int i=2,count=0;
short isprime();
system("clear");
printf("The First 25 Prime No's r:\n");
while(count<MAX)
{
if(isprime(i))
{
printf("%d ",i);
count++;
}
i++;
}
printf("\n");
}
short isprime(int i)
{
int j;
short check=1;/* It says wether the No. is prime or not assume that its prime*/
for(j=2;j<=sqrt((double)i);j++)
if(!(i%j)){check=0; break;}/* If its divisible by any No. less then */
return(check); /* its sqrt then break & say not prime */
}

### Like this:

Like Loading...

*Related*