Difference between for loop and do while loop
Bhanu Teja
1 min read
Table of contents
FOR LOOP=The loop in which statements get executed if and only if the condition is satisfied..
Syntax: for(i=0:i<n;i++)
{
//Code
}
DO WHILE LOOP=The loop in which statements executed at least one time even though if the condition is not satisfied..
Reason:As we know program is executed step by step..
Here Do block comes before condition statement..so statements in do block executes before checking the condition for the first time...here how it works
Syntax: do {
//Code
}
While(condition)
0
Subscribe to my newsletter
Read articles from Bhanu Teja directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by