0

What is the difference between while and do while statements

c

9/15/2019 12:22:20 PM

Likhitha Kande

3 Answers

New Answer

+4

"while" is pre - test, it check the condition first before executing the inside code , while the "do while" is post - test that it execute the code first then check the condition.

+2

x = 1 example: while(x > 2){ display "hello" } output : (no ouput) because the condition is already false do { dipslay "hello" } while(x > 2) output : hello

+2

while loop first check the condition then execute the code inside the loop do while first execute the code inside the loop then check the condition So do while execute once even the condition is false