Need a little help understanding this. Program for class and I'm not expecting an answer per say, but an explanation on how to start the loop.
I have to determine if a number is prime or not using a for loop.
I have the return false if it's 0,1, or negative. I need this:
the function should use a for loop to test if there are any devisors of the number (x) that do not result in a reminder.
I don't know how to set up the for loop to test devisors.. This is where i'm stuck:
Code
if (x == 0 || x == 1 || x < 0) {
return false;
}
else {
for (x; x > 1; x++){
}
}
Help is cool :)!
This post was edited by ChunkyFunk on Oct 9 2015 12:14pm