14 Answers - Sort by: Date | Rating
A do while loop runs at least once even though the the condition given is false
while loop do not run in case the condition given is false
while loop do not run in case the condition given is false
1
0
Guest
answered 8 months ago
In a while loop the condition is first tested and if it returns true then it goes in the loop, while in a do-while loop the it enters the loop 1st and does the 1st iteration and then does the checking at the end.... If at the end in a do-while loop it returns true the 2nd iteration follows , but if it returns false then it goes out of the loop...
1
0
In while loop first condition is check if it is not true than iteration is takes palace but in do while loop after first iteration condition is check either it is true or false.
1
0
Guest
answered 5 months ago
Guest
answered 6 months ago
1. In While loop the condition is
tested first and then the statements are executed if the condition turns out to
be true.
In do while the statements are executed for the first time and then the conditions
are tested, if the condition turns out to be true then the statements are
executed again.
2. A do while is used for a block
of code that must be executed at least once.
These situations tend to be relatively rare, thus the simple while is more commonly
used.
3. A do while loop runs at least once
even though the the condition given is false
while loop do not run in case the condition given is false
4. In a while loop the condition is
first tested and if it returns true then it goes in the loop
In a do-while loop the condition is
tested at the last.
5. While loop is entry control loop
where as do while is exit control loop.
6. Syntax:
while loop :
while (condition)
{
Statements;
}
do while loop :
Do
{
Statements;
}while(condition);
tested first and then the statements are executed if the condition turns out to
be true.
In do while the statements are executed for the first time and then the conditions
are tested, if the condition turns out to be true then the statements are
executed again.
2. A do while is used for a block
of code that must be executed at least once.
These situations tend to be relatively rare, thus the simple while is more commonly
used.
3. A do while loop runs at least once
even though the the condition given is false
while loop do not run in case the condition given is false
4. In a while loop the condition is
first tested and if it returns true then it goes in the loop
In a do-while loop the condition is
tested at the last.
5. While loop is entry control loop
where as do while is exit control loop.
6. Syntax:
while loop :
while (condition)
{
Statements;
}
do while loop :
Do
{
Statements;
}while(condition);
0
0
Guest
answered 3 months ago
Guest
answered 3 months ago
While loop test condition before statement execution
do while test condition after statement execution
do while test condition after statement execution
0
0
Guest
answered 3 months ago
In-case of while loop the given condition is checked and the statement of loop will be executed if the condition found to be true.
But At Do-while loop the given statement will be executed atleast once and thereafter the condition will be checked. And if condition founds false the execution stops.
This is the BAsic difference between while loop and do-while loop.
And I hope this will help you.
See you.
But At Do-while loop the given statement will be executed atleast once and thereafter the condition will be checked. And if condition founds false the execution stops.
This is the BAsic difference between while loop and do-while loop.
And I hope this will help you.
See you.
0
0
Guest
answered 2 months ago
-In while loop condition testing is done in the beginning of the loop execution each time
-In do while condition testing is done after running the loop each time
-In do while condition testing is done after running the loop each time
0
0
In a do while loop runs at least once even though the the given condition is false but in while loop do not run in case the given condition is false.the while testes the condition before executing any of the statement within the while loop.the do-while loop tests the condition after executed the statement within the loop.
0
0
In general both the while loop and do-while loop are iterative control structures in any programming language. Both are conditional loops because these are based on conditions (Boolean expressions). The value of Boolean expression (true /false) determines whether the loop exits or not.
But there is a little difference in their way of iterating. The basic difference is in the time of checking the condition during execution of loop. In while loop the condition is checked at the start, if it is true then statements enclosed in the loop structure are executed , otherwise the loop exits and control transfers to the statements following this loop and this process continues until the condition becomes false.
As:
While (condition)
{
statement1;
statement2;
.
.
}
Statements following the loop;
But in the case of do-while loop condition is checked at the end of structure (i.e., at least one time the statements enclosed in this loop structure are executed before checking the condition)
After executing the loop statements at least once, the loop condition is checked; if it is true then the loop body is executed again otherwise loop exits. As:
Do
{
statement1;
statement2;
.
.
}
While (condition)
Statements following the loop;
Thus ,their syntax shows clearly how these two loops are different from each other.
But there is a little difference in their way of iterating. The basic difference is in the time of checking the condition during execution of loop. In while loop the condition is checked at the start, if it is true then statements enclosed in the loop structure are executed , otherwise the loop exits and control transfers to the statements following this loop and this process continues until the condition becomes false.
As:
While (condition)
{
statement1;
statement2;
.
.
}
Statements following the loop;
But in the case of do-while loop condition is checked at the end of structure (i.e., at least one time the statements enclosed in this loop structure are executed before checking the condition)
After executing the loop statements at least once, the loop condition is checked; if it is true then the loop body is executed again otherwise loop exits. As:
Do
{
statement1;
statement2;
.
.
}
While (condition)
Statements following the loop;
Thus ,their syntax shows clearly how these two loops are different from each other.
0
1
While loop is entry control loop where as do while is exit control loop.
while=> condition of loop is checked first befor executing the body of loop.
Do while=> condition of loop is checked after executing the body of loop.i.e loop execute at least once.
It is mainly used in menu like programmes where all the available choices are printed at least once.
while=> condition of loop is checked first befor executing the body of loop.
Do while=> condition of loop is checked after executing the body of loop.i.e loop execute at least once.
It is mainly used in menu like programmes where all the available choices are printed at least once.
0
1
In while loop after checking the condition the loop executes or exits based on the condition result.But in the do-while loop first the statements enclosed with the loop executes and then it checks the condition.
0
1
Guest
answered 7 months ago
- How To Create An Application By Using Java Program?
- How To Make An Application By Using Java Program?
- I Am Non IT Professionals And Now I Want To Join MS Dynamics CRM. I Learnt Tha C# And ASP.net Is Must For That?
- What Is The Definition Of Hierarchical?
- What Is Rule Based Query?
- A B C D E A B C D A B C A B A Search Program For This Output (using For Loop)?
- How To Convert Binary To Octal In Java Programming?
- What Is Overloading In Java?
- Why Relations Should Not Have Transitive Dependency. Illustrate With Example?
- Create A Program That Displays Color Of An Item Whose Item Number Is Entered By User In C++?
- What Compression Programs Are Associated With Zip Sit And Exe File Extensions?
- Network Data Model And How Its Structure Contributed To Database Environment Development?
- What Is Header File & Its Significance In C Programming Language?
- Write A Program To Display The Pattern Like. * ** *** **** *****
- Write A Program To Find The Factorial Of 15?
- Write A Program To Accept A Number And Display All The Natural Numbers Below That Number? Hint : If You Enter 5, The Result Will Be 15 -> 1+2+3+4+5 = 15
- What Is Power And How Does It Relate To Error?
- Read (in A Loop Of Course) A Number, N, And Print A Pyramid That Has That Size. The Example Below Shows What Would Be Printed For N=4?
- What How The Step For Make Library Management?
- How Do I Used Array And Queue To Show How Customers Can Shop Online?
- What Is Null In Database?
- In Which Process We Can Start Java?
- What Is Pointer Registers?
- What Is Relationship In Terms Of Dbms?
- How To Download Java IDE?
- Explain The Basic Difference Between For And While Loop With And Example?
- What Is Basic Difference Between Entry Controlled Loop And Exit Controlled Loop?
- What Is The Difference Between For And While Loop?
- What Is The Difference Between While And Do While Loop…?
- What Is The Difference Between Do While...loop And Do...loop While?
- What Is The Difference Between While Loop And Dowhile Loop?
- What Is The Difference Between A Pre-test And Post-test Loop?
- What Is The Basic Difference Between Starch And Cellulose?
- What Is The Basic Difference B/w "ISP" And "BROWSER"?
- What Is The Basic Difference Between Bond And Debenture?
- What Is The Basic Difference Between Structure And Class In C++?

New Comment - Comments are editable for 5 min.