+ 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?

14th Apr 2020, 6:13 AM
Zhengrong Yan
Zhengrong Yan - avatar
2 ответов
+ 4
You code outputs 4 3 and then it loops forever because you never change 'num' when it equals 3 append num--; before continue;}
14th Apr 2020, 6:25 AM
andriy kan
andriy kan - avatar
+ 2
You also could remove your num--; line and just do this if (num-- ==3) since the if statement is always checked
14th Apr 2020, 6:48 AM
ChaoticDawg
ChaoticDawg - avatar