At 10/8/13 12:32 PM, Diki wrote: Works fine for me. What did you try where it didn't work?
Honestly, I tried to do this with C++:
bool isPrime(int num) {
int j;
for (j = 2; j < ((static_cast<int>(sqrt(num)) + 1)); j++) {
if ((num % j) == 0) return false;
}
return true;
}
That code works as well. If it's not working for you then there must be a glitch in some other code that you're using.
At 10/8/13 01:20 PM, Diki wrote: That code works as well. If it's not working for you then there must be a glitch in some other code that you're using.
Sweet, I fixed my code before you posted your response.