Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- ios::sync_with_stdio(false);
- int n,i,j,x;
- cin>>n;
- int a[100000]= {0};
- for(i=2; i<n; i++) {
- if(a[i]==0) {
- cout<<i<<'\n';
- for(j=2,x=j*i; x<n; j++) {
- x=j*i;
- a[x]=1;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement