top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between the while and do while loop in C?

+2 votes
1,147 views
What is the difference between the while and do while loop in C?
posted Apr 3, 2017 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

3 Answers

+1 vote

One and one only difference I found is "while" loop first checks the condition and then enters into the loop block statements.
In "do ... while() ", at least once statements execute then it checks for loop condition.
Both are loops and which one should be used it depends on requirement.

answer Apr 4, 2017 by Harshita
+1 vote

While loop is entry controlled loop and do while loop is exit controlled loop.

answer Apr 5, 2017 by Priya Jadhav
0 votes

The do while loop executes the content of the loop once before checking the condition of the while.
Whereas a while loop will check the condition first before executing the content.
therefore do while runs the loop atleast once even though the loop condition is false.

answer Jul 12, 2017 by Rohini Dv
...