+ 1
why this is no output?
#include <stdio.h> int main() { int num = 5; while (num > 0) { if (num == 3){ continue;} num--; printf("%d\n", num); } } why this is no output?
2 Answers
+ 4
You code outputs
4
3
and then it loops forever because you never change 'num' when it equals 3
append
num--;
before
continue;}
+ 2
You also could remove your
num--;
line and just do this
if (num-- ==3)
since the if statement is always checked