Need program to print all prime numbers?

how to write a programme in C language print all the prime numbers 2-1000???

I’m sorry this is not “write my homework” page…

Show us some effort - what you did.

You can start with a definition of a prime number.

1 Like

#include<stdio.h>
int main()
{
int i,j;
for(i=2;i<=1000;i++)
{
for(j=2;j<=1000;j++)
if(i%j==0)
break;
if(i==j)
printf("%d\t",j);}
return 0;
}

1 Like

use Sieve of Eratosthenes. wiki

1 Like

(y)
thnx a lot

LINK TO PRIME NUMBER PROGRAM

Look at above link. Some basic optimization was handled