what is the difference b/w do while,while and for loop..with example..
The for loop is used to repeat a task a set number of times.
While loop is a control flow statement that works repeatedly based on a given boolean condition, loop will continuously execute the statements given in the body as long as a given condition is true.
Do while Loop:
do-while loop is same as the while loop statement but while loop checks the certain condition is first and if condition is true then statements or processes are executed otherwise all the statements written under the while loop is ignored by the interpreter but do - while loop executes all the statements first at once and then check the condition if the condition is true then all the statements are also executed in second times otherwise second times ignored all the statements.
For more information, visit the following links: