+ 1
i need some help
im making a code that add al the prime numbers up to the given number of the user, but the problem is that is not giving me the right result, for example if i introduce the number 23, the result should be 101 but the program is giving me 100. if some body know how to fix it its going to help a lot. https://code.sololearn.com/cQHJE3A1CR2S/?ref=app
3 odpowiedzi
+ 8
Your code works correctly. For input 23, 100 is the correct result. 1 is not a prime.
+ 7
And what makes you think that the result should be 101?
What should be 1 in the list?
+ 1
Tibor Santa You right, my bad I was doing the math the wrong way, thanks 👍