SHARE
TWEET

C Prime Number Serise using Sieve Method

naeem043 May 11th, 2018 (edited) 17 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5.     int n[100], i,j;
  6.     for(i=0;i<100;i++) n[i] = 0;
  7.     for(i=2;i<100;i++,j++)
  8.     {
  9.         for(j=i;j<=100;j++)
  10.         {
  11.             int m = j*i;
  12.             if(m<100) n[m] = 1;
  13.         }
  14.     }
  15.     for(i=2;i<100;i++)
  16.     {
  17.         if(n[i] == 0) printf("\t %d",i);
  18.     }
  19.     return 0;
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top