Guest User

Untitled

a guest
Feb 18th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.22 KB | None | 0 0
  1. # include "iostream"
  2.  
  3. using namespace std;
  4.  
  5. int main () {
  6.     int n,i,j;
  7.     cin >> n;
  8.    
  9.     for (i=1;i<=n;i++) {
  10.         for (j = 2; j * j <= i && i % j; ++j);
  11.         if (j * j > i && i - 1)
  12.             cout << i << " ";
  13.     }
  14.    
  15. return 0;}
Add Comment
Please, Sign In to add comment