Do...While...Loop

Do...While...Loop:

This loop is similar as While...Wend Loop. It executes one or more statements while given condition is true.
Syntax:
The syntax of this loop is as follows:
Do While <condition>
       Statement(s)
       Statement(s)
Loop

Working of  Do...While...Loop:

First of all,the condition is evaluated. If it is true, the control enters the body of  loop and execute all the statements as like as while loop After executing the body it again moves the starting position and check the condition again.

Flowchart:

Example-1:

Write  a program that display the sum of first five numbers using do...while...loop.
  • Start a new standard EXE project.
  • Design the form as follows.

  • Open the click event of button & add this code.





















  • Run The Project and click on button. The input box will appear for five times




No comments:

Post a Comment