Checkout stand algorithm with loops

We have seen that conditional-execution statements If and Case can be used to deviate from sequential execution. Loops, in which instructions are executed repeatedly, are another common means of deviating from sequential execution.

This flowchart shows an algorithm for a cashier at a supermarket checkout stand. It has three loops. Each loop has a body and a termination condition. The body is executed repeatedly until the termination condition is satisfied. Once it is satisfied, the loop terminates and execution continues with the next sequential instruction.

Note that two of the loops are nested inside the outer loop


Disclaimer: The views and opinions expressed on unofficial pages of California State University, Dominguez Hills faculty, staff or students are strictly those of the page authors. The content of these pages has not been reviewed or approved by California State University, Dominguez Hills.