difference between do while and for loop in ''C"
Answers
Answered by
1
Answer:
for loop:
for loop provides a concise way of writing the loop structure. Unlike a while loop, a for statement consumes the initialization, condition and increment/decrement in one line thereby providing a shorter, easy to debug structure of looping.
Syntax:
for (initialization condition; testing condition;
increment/decrement)
{
statement(s)
}
Answered by
1
Answer:
In while loop if initialization is done during condition checking, then initialization is done each time the loop iterate. In 'for' loop iteration statement is written at top, hence, executes only after all statements in loop are executed. In 'while' loop, the iteration statement can be written anywhere in the loop.
Similar questions
Math,
2 months ago
Math,
2 months ago
Math,
2 months ago
Physics,
4 months ago
Hindi,
4 months ago
Political Science,
10 months ago
Social Sciences,
10 months ago