daily pastebin goal
63%
SHARE
TWEET

Untitled

a guest Oct 17th, 2018 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. int prime(int n)
  3. {
  4.     for (int i = 1; i < n; i+=2)
  5.     {
  6.         bool is_prime = true;
  7.         for(int j = 3; j < sqrt(i); j++)
  8.         {
  9.             if (i % j == 0)
  10.             {
  11.                 is_prime = false;
  12.                 break;
  13.             }
  14.         }
  15.        
  16.         if (is_prime)
  17.             cout << i << " ";
  18.     }
  19. }
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