Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. ios::sync_with_stdio(false);
  5. int n,i,j,x;
  6. cin>>n;
  7. int a[100000]= {0};
  8. for(i=2; i<n; i++) {
  9. if(a[i]==0) {
  10. cout<<i<<'\n';
  11. for(j=2,x=j*i; x<n; j++) {
  12. x=j*i;
  13. a[x]=1;
  14. }
  15. }
  16. }
  17. return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement