Computer Science, asked by foridull, 11 months ago

What is the difference between a while
and do-while loop?

Answers

Answered by PrashantMishra420420
0

The most important difference between while and do-while loop is that in do-while , the block of code is executed at least once, even though the condition given is false. ... In While loop, the condition is first tested and then the block of code is executed if the test result is true.

Answered by msrishti0104
0

Answer:

> While loop - The condition is checked before each iteration.

> do-while loop - The condition is checked at the end of each iteration.

> While loop- It is an entry controlled loop.

> Do-while loop - It is an exit controlled loop.

> While loop - Since condition is checked first,statements may or may not  be executed.

> Do-while loop - Since condition is checked later, the body statements will execute at at least once, even if the condition evaluates to false.

>While loop:

while(Expression)

{

// block of statements

}

> Do-while loop:

do

{

//block of statements

}

while(Expression);

Explanation:

Similar questions