MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / printAllPrime

Function printAllPrime

CPP/Maths/seiveOfEratothenes.cpp:4–15  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2using namespace std;
3
4void printAllPrime(int n){
5 vector<bool> isPrime(n+1,true);
6 for(int i=2; i<=n ; i++){
7 if(isPrime[i]){
8 cout<<i<<" ";
9 for(int j= i*i; j<=n; j=j+i){
10 isPrime[j] = false;
11 }
12 }
13 }
14
15}
16
17int main(){
18 int n;

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected