Created
July 26, 2017 06:24
-
-
Save lazyakshay/416e8cea95d60e8dd43fbd958c320920 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
using namespace std; | |
int main() | |
{ | |
//cout << "Hello World!" << endl; | |
//vector<int> prime; | |
int n; | |
cin>>n; | |
int p=2; | |
while(p<=n){ | |
int flag=0; | |
for(int i=2;i*i<=p;i++){ | |
if(p%i==0){ | |
flag=1; | |
break; | |
} | |
} | |
if(flag==0) cout<<p<<" "; | |
p++; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment