0
Prime number
Can I write a code in c++ or python that outputs all prime numbers less than the input n?
5 Respostas
+ 9
Yes, off course you can! 👍
+ 7
luca
I hope, this will help you! 👍
https://code.sololearn.com/cIq5PZ7yhZlQ/?ref=app
+ 5
You need to understand the algorithm.
Search this: "Sieve Of Erathnostenes" and this will help you.
+ 1
how can i?
+ 1
For (int i=2, o = 0; i<n;++i) {
for(int j=2;j*j<=n;++j)
If (i%j==0)
o = 1;
If(!o)
cout << i << endl;
}