Which of the following flowcharts will be most appropriate for printing first…
2022
Which of the following flowcharts will be most appropriate for printing first 8 multiple of 9 ?
Attempted by 508 students.
Show answer & explanation
Key idea: use a counter that runs from 1 to 8, and on each iteration print 9 × counter.
Step 1: Initialize the counter I = 1.
Step 2: Check the condition I <= 8. If false, stop.
Step 3: If condition is true, print 9 × I.
Step 4: Increment the counter: I = I + 1.
Step 5: Go back to Step 2 and repeat until the condition is false.
Printed sequence: 9, 18, 27, 36, 45, 54, 63, 72
Why other flowchart variants are incorrect:
If the counter is incremented by 2, some multiples are skipped (only four values printed).
If the process starts with I = 9 and uses the test I < 72, the final value 72 will be missed because 72 is not less than 72.
If the flowchart adds 9 before printing (increment then print) starting from 9, it can skip the first multiple or later produce incorrect bounds.
If the increment is missing or placed so the counter is not updated each cycle, the loop may not progress correctly (infinite loop or repeated prints).