+ 1
Prime numbers < 1000
Hello can anyone print out the code to have the first prime numbers in c++ all must be below 1000 And also a second code showing all the 100 prime numbers. Thanks
3 Respostas
+ 3
https://code.sololearn.com/cxO6xwQRsZPS/#cpp
How about this approach?
0
Hey Stefan i am not getting the logic could you please tell me what you did in this code
0
Ash
I used the Sieve of Erathosthenes.
You start by assuming that every number is a prime one.
When you find a number that is prime you must mark every multiple of that number as not being prime (because they divide by your prime number).
So if prime[i] is prime( in my program its value is false) you print i.