Which loop is most suitable to first perform the operation and then test the condition?
Answers
The "do-while" loop is most suitable to first perform the operation and then test the condition.
In the do while loop the condition is checked at the bottom of the loop. Hence even if the condition is false the loop will execute at least one time.
The syntax of a do-while loop in C programming language is:
do {
statement(s);
} while( condition );
Hence we can see first the statement will be executed then the condition is checked.
The "do-while" circle is most appropriate to initially play out the activity and afterward test the condition.
In the do while circle the condition is checked at the base of the circle. Thus regardless of whether the condition is false the circle will execute no less than one time.
The punctuation of a do-while circle in C programming dialect is: do {statement(s);} while( condition ).