Addition of Continue


#1

When I got to the section on the addition of Continue to the “for loop” I started playing with different number in the "if (i % 3 == 0) and found that if you use a number that is divisible by the answer (5 goes in evenly to 10) to the “break” section it ruins the results for the entire code string. Does anyone know the reason this happens? code that is breaks is below

#include <stdio.h>

int main(int argc, const char * argv[])
{
int i;
for (i = 0; i < 12; i++) {
if (i % 5 == 0) {
continue;
}
printf(“Checking i = %d\n”, i);
if (i + 90 == i * i) {
break;
}
}
printf(“The answer is %d.\n”, i);

return 0;

}


#2

When ‘i’ eventually equals 10 and hits the first ‘if’ statement with the remainder equaling 0 the ‘continue’ statement executes and the next statement executed is the ‘for loop iteration’ and ‘i’ will then equal 11 at that point, and eventually 12 and then break out of the ‘for loop’ and then it prints that the answer is 12(wrong), remember that ‘i’ at this point equals 12. So the second ‘if" statement is never tested when ‘i’ equals 10(the correct answer)’ causing the unintended results.