Sieve of Eratosthenes C++ code
![sieve of eratosthenes c++ code](https://freecodecenter.com/wp-content/uploads/2023/05/579c990e-b4a2-497e-ace1-37f912db0729-1-1024x438.webp)
For the first time, I have developed a C++ application that compiles and runs flawlessly. I’ve made the decision to learn C++, and in order to become comfortable with the language, I’ve developed my first C++ program, which I wrote all by myself after only a few hours of instruction. (Also, no “Hello, World.” program has been written by me.
Example:1
#include<iostream> using namespace std; void primeSieve(int n) { int prime[100]={0}; for(int i=2;i<=n;i++) { if(prime[i]==0){ for(int j=i*i;j<=n;j+=i){ prime[i]==1; } } } for(int i=2;i<=n;i++) { if(prime[i]==0) { cout<<i<<" ";
}cout<<endl;
}
} int main() { int a; cin>>a; primeSieve(a); }