Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # include "iostream"
- using namespace std;
- int main () {
- int n,i,j;
- cin >> n;
- for (i=1;i<=n;i++) {
- for (j = 2; j * j <= i && i % j; ++j);
- if (j * j > i && i - 1)
- cout << i << " ";
- }
- return 0;}
Add Comment
Please, Sign In to add comment