You’re printing the output before you check whether or not you want to print the output. Swap the logic:
if (num== 5 || num== 2 || num==3) {
continue;
}
printf("The num %d is available\n", num);
Or, conversely you can omit the continue
:
if (num != 5 && num != 2 && num != 3) {
printf("The num %d is available\n", num);
}
It’s a matter of personal preference and readability, either one should produce the same output.
4
solved The continue statement in my C program doesn’t seem to work [closed]