
18 Programming and Data Structures
Then the condition would be like this.
If (21)
Connect 'sales department'
Else
If (22)
Connect 'accounts section'
Else
Return to the telephone operator.
1.9 ITERATION AND RECURSION
Iteration
In a program, sometimes, it is very necessary to perform the same action for a number of times. If
the same statement is written repetitively, it will increase the program code. To avoid this problem,
iteration mechanism is applied. The statement written in iteration block is executed for a given
number of times based on certain conditions. The iteration is shown in Fig. 1.22. In C/C++ iteration
can be performed using th