Nested Loop

Nested Loop:

A Loop within a loop is called nested loop.In nested loop the instructions of inner loop is executed if the condition of outer loop is true.

Syntax:

The Syntax of Nested Loop is follows:

Example-1:

  • 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 on button.
  • Output will be show as.













How  it Works:

In the above example the outer is executed two time, With each time inner loop is executed three times. When the condition of outer loop is false the inner loop is not executed.


No comments:

Post a Comment