Sieve of Eratosthenes C++ code

Sieve of Eratosthenes C++ code

sieve of eratosthenes c++ code

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.


#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<<" ";


} int main() { int a; cin>>a; primeSieve(a); }

see more

C++ Program to Read an Amount and Find Number of Notes

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
NEW TOXIC ROCKET CYCLE DECK in Clash Royale 2023 Best Deck in Clash Royale Best Deck for Arena 8 in Clash Royale Best Hog deck for Pro players Best Clash Royale Deck