answersLogoWhite

0

Do while loop in turbo c?

Updated: 8/20/2019
User Avatar

Wiki User

6y ago

Best Answer

do {
// statement;
} while (expression);

The statement body is executed at least once. At the end of each iteration, the expression is evaluated. If false (or 0), the loop terminates. If true (or non-zero), the statement body executes another iteration.

Like any other loop structure, a do loop can be terminated by a break or return statement within the statement body. If a continue statement is encountered within the statement body, execution passes to the while clause where expression is re-evaluated.

To understand how a do loop differs from a while loop, compare the following:

int x;

x = 0;
do {
printf ("%d ", ++x);
} while (x<10);
printf ("\n");

x = 0; while (x<10) {

printf ("%d ", ++x);

};

printf ("\n");


Output:

1 2 3 4 5 6 7 8 9 10

1 2 3 4 5 6 7 8 9


Note that the while loop does not print the value 10. This is because the control expression (x<10) is evaluated before each iteration begins. In a do loop, it is evaluated after each iteration has finished.


User Avatar

Wiki User

6y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Do while loop in turbo c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Is for loop is faster than while loop in turbo c plus plus compiler?

No, why did you think so?


For loop program turbo c making a right triangle?

yes


What is the shortcut key in laptop to stop infinite loop of turbo c?

567


Which loop is also called an exit-condition loop in C programming?

The do while loop is also called an exit condition loop in c, c++, and java.


Is do while loop in c is exit controoled loop?

yes


Sample do while loop in turbo c?

int main (int argc, char **argv) { int i=0; do printf ("%2d. %s\n", i, argv[i]); while (++i&lt;argc); return 0; }


What are the differences between Do While and For loops in C?

In short, a for loop declares an variable and assigns it a value, has an argument, and has an update. A while loop only has an argument. More Detail... in C++, which is very close to C an example while loop is; while(i


What is a while statement in turbo c plus plus?

A while statement is one type of looping statement. by which we can start a loop in our programs. while loop is precondition checking statement, because it first check its condition then loop will go to its body part. EX. while(i&gt;0) { //body part } here when i will &gt;0 then it will check it body part and execute it and display result.


What is the definition of 'nested' in C programming?

In C a structure within a structure is called nested. For example, you can embed a while loop in another while loop or for loop in a for loop or an if statement in another if statement.


Do-while loop in c?

Available.


Do while in turbo c?

usable


What is the difference between a do while loop and a for loop in c?

the counter variable cannot be initialized in while loop before entering into the block.