daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Dec 18th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void primes(int primes[], int n) {
  2.     int nth_number = 0;
  3.     for (int i=2; i<n; i++)
  4.         for (int j=2; j*j<=i; j++)
  5.         {
  6.             if (i % j == 0)
  7.                 break;
  8.             else if (j+1 > sqrt(i)) {
  9.                 cout << i << " ";
  10.                 primes[nth_number++] = i;
  11.             }
  12.  
  13.         }  
  14. }
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