0

Why doesn't this code print anything?

#include <stdio.h> int main () { int a = 10; while(a <= 20) { if( a == 15) { // skip the iteration //a = a + 1; continue; } printf("value of a: %d\n", a); a++; } return 0; }

12th Mar 2022, 5:10 PM
Ximeno el Fuerte
Ximeno el Fuerte - avatar
3 Answers
+ 1
You can use break instead of continue to get out of the while loop; continue just goes back to the beginning of the while.
12th Mar 2022, 7:35 PM
JRS
JRS - avatar
0
I already figured out what was happening. Thanks for your help
12th Mar 2022, 9:13 PM
Ximeno el Fuerte
Ximeno el Fuerte - avatar