Do...Loop...Until

This loop is executes one ir more st of statements while the given condition is false.This loop is similar to Do...While...Loop except that it first executes the body and then checks the condition. It means that the body of the loop is executed once even if the condition is true. So the loop should be used when we want to execute a statement st least once.

Syntax:

Do

statement (s)

Loop Until condition

Flow Chart:

   The Flow Chart loop is as follows:

Example-1:

Write a program to display first five numbers and their square using Do...Loop...Until.
  • Start a new standard EXE project.
  • Design the form as follows.
  • double click the click event of  input button and write following code.

  • Run the project and click the button.
  •  Output will be show as.

No comments:

Post a Comment