RVBTCC/test/loop/continue.c
2025-05-05 16:20:27 +08:00

38 lines
No EOL
613 B
C

int printf(char* format, ...);
int main() {
int i;
printf("For loop:\n");
for (i = 0; i < 5; i++) {
if (i > 3) {
continue;
}
printf("%d ", i);
}
printf("\n");
printf("While loop:\n");
i = 0;
while (i < 5) {
if (i > 3) {
i++;
continue;
}
printf("%d ", i);
i++;
}
printf("\n");
printf("Do-while loop:\n");
i = 0;
do {
if (i > 3) {
i++;
continue;
}
printf("%d ", i);
i++;
} while (i < 5);
printf("\n");
}