- 1
Unknown error in prime number
I don't know what is wrong with my code but When I input a small number like 12 I am get correct output but when I input 47 my code outputs // It is not prime It is prime Don't know what's wrong? https://code.sololearn.com/cqZn7sdusQup/?ref=app
7 odpowiedzi
+ 3
I'm quite confused why are you doing modulo i%b instead of a%i in your code. If you do it a%i it returns correct result.
+ 2
he needs that while loop, this code will fail in cases like 9.
Just replace i%b with a%i.
+ 2
Shyamal Bhatt he/she told you what was wrong with your code. He shouldnt have to spoonfeed you it. All you’re doing is changing 1 line.
0
n3v375 but what is wrong with my code
0
As Ole mentioned I shouldn't do this, but here you go anyways
https://code.sololearn.com/c4xfjN9kxfW0/?ref=app
0
Mateusz R
Thanks buddy 😎
- 2
Mateusz R
Can u upload the correct version