answersLogoWhite

0

What are uses of do while?

Updated: 8/11/2023
User Avatar

Wiki User

10y ago

Best Answer

A do-while loop is only useful when you want the loop to execute at least once. This is because the conditional expression is evaluated at the end of each iteration, rather than before each each iteration as it is in a for and a while loop.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

Hi

The syntax of a do..while() loop is as follows:

do

{

<statements>

} while(<condition>);

For example

#include <stdio.h>

void main(){

int count = 5;

int i = 0;

do{

i++;

printf("%d\n",i);

}while(i < count);

}

The output will be:

1

2

3

4

5

The point to be noted here is that do.. while() is an exit-controlled loop. This means that the condition is tested only after the first iteration of the loop is executed. Hence even if the condition if false, the loop will run at least once.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

In programming the function is a named section of programming that completes the designated task, in this occupation the function is also a procedure or routine to be carried out in programming.

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

int i=1; while (i<=5) { printf("%d",i); i++; int i=1; do { printf("%2d",i); i++; } while(i<=5);

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

do...while is a one kind of exit control loop.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

iteration, also known as looping or cycling

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are uses of do while?
Write your answer...
Submit
Still have questions?
magnify glass
imp