0
Need Help.
Why this code print "Hello World" 5 times? Code: https://code.sololearn.com/c0jDmo4gtf8W/?ref=app
2 ответов
+ 10
The loop skips the iteration when the value of i == 3 (due to the continue statement) and works for the rest normally.
The control flow -
× when i==1 => prints Hello world
× when i==2 => prints Hello world
× when i==3 => skips this iteration
× when i==4 => prints Hello world
× when i==5 => prints Hello world
× when i==6 => prints Hello world
Therefore Hello World is printed five times.
P.S. - Learn more about the break and continue statements in C -
https://www.sololearn.com/learn/2388/?ref=app
+ 4
if(i==3)continue;
When the value of the i is 3, the printf isn't excuted.