. Differentiate between while, do...while, and for loops in terms of their syntax.
Answers
Answered by
4
Answer:difference between while and do while
Explanation:
while loop...
syntax:
while ( condition) {
statements; //body of loop
}
In 'while' loop the controlling condition appears at the start of the loop.The iterations do not occur if, the condition at the first iteration, appears false.
it is a Entry-controlled loop
Semi-colo Not used..
do while loop...
syntax:
do{
.
statements; // body of loop.
.
} while( Condition );
In 'do-while' loop the controlling condition appears at the end of the loop.
The iteration occurs at least once even if the condition is false at the first iteration.
it is Exit-controlled loop.
Semi-colon used at end of the loop.
Similar questions
Math,
5 months ago
Math,
5 months ago
Math,
10 months ago
Social Sciences,
10 months ago
Political Science,
1 year ago