I did the prime checker problem on hackerblocks and one of the test case failed. My code is little different from what sir wrote, but can somebody explain what is wrong with my code?
Prime Checker Problem
please provide link of code
This is the code written by sir
This is the code I wrote
also send the link of code and problem so that i can check and rectify it
photo will not helps
save code at https://ide.codingblocks.com/ and send link generated
okay, I’ll paste the problem here and send you the link of the code.
Question:
i got the mistake you have done
suppose you want to find whether 25 is prime or not
you check it with 2 that it is not divisible by 2
will this is okay now can you say it is prime
obviously not you have to check till n-1
but what you have done
if it is not divisible you just say prime which is wrong
This is the link to my code
will you got it ??
sir code is correct follow that approach
1 Like
Okayy, i got my mistake… Thanks alot sir