Definition of loop and its types and programs in c plus plus?

1 answer

Answer

1130118

2026-07-16 18:35

+ Follow



Executing a segment of a program repeatedly by introducing a counter and later testing it using the if statement.

A sequence of statements are executed until some conditions for termination of the loop are satisfied.

A Program loop consists of two segments:
1.Body of the loop
2. Control Statement


Depending on the position of the control statement in the loop, a control strcture may be classifies either as the 2:

  1. Entry Controlled Loop
  2. Exit Controlled Loop
1.Entry Control Loop-(Pre Test Loop)
The control conditions are tested before the start of the loop execution.
If the conditions are not satisfied , then the body of the loop will not be executed.]
eg:
While Loop

2.Exit Control Loop-(Post Test loop)
The Test is performed at the end of the body of the loop and there fore the body is executed unconditionally for the first time.
eg:
Do-While



while loop
for loop
do-while loop

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.