do-while Loop
2.do-while Loop:
This loop is used when a statement needs to be run initially, followed by a comparison of the results at the bottom of the loop. If the condition is met or true, the loop is continued otherwise it is halted.
The computer first enters the do-while loop's body, runs it, and then checks the condition. If the condition is true, it loops back around until it is still true; if the condition is false, it moves on to the next statement.
Syntax:
Flowchart:
Ex:
Display 1,2,........100
Comments
Post a Comment