Search⌘ K
AI Features

Discussion: Say It Again—Or Not

Understand the execution flow of loops in C, focusing on do-while and for loops. Learn why do-while loops run at least once regardless of the condition and how loop variables change after loop completion. This knowledge helps improve code control flow and string manipulation in C.

Run the code

Now, it's time to execute the code and observe the output:

C
#include <stdio.h>
int main()
{
int a = 11;
do
{
printf("a = %d\n", a);
a--;
}
while(a<10);
return(0);
}

Understanding the output

The loop repeats once despite the value of variable a being greater than the loop’s terminating condition:

a = 11
Code output

Explanation

...