Flowchart CS Thinking Example 2
Follow the full solution, then compare it with the other examples linked below.
Example 2
mediumDescribe the flowchart for a program that keeps asking the user to enter a password until they enter the correct one ('secret123'), then outputs 'Access granted'.
Solution
- 1 Step 1: Start โ Input: 'Enter password' (parallelogram) โ Decision: password == 'secret123'? (diamond).
- 2 Step 2: If No โ loop back to the Input step. If Yes โ Process/Output: 'Access granted' (parallelogram) โ End.
- 3 Step 3: The loop is shown by the 'No' arrow going back to an earlier step. This visually represents a WHILE loop โ repeat until the condition is met.
Answer
Start โ Input password โ Decision (correct?) โ No: loop back to input โ Yes: Output 'Access granted' โ End.
Flowcharts make loops visible โ the backward arrow clearly shows repetition. This is why flowcharts are especially helpful for understanding loop logic before coding.
About Flowchart
A visual diagram that represents the steps of an algorithm using standard shapes: ovals for start and end, rectangles for processes or actions, diamonds for decisions (yes/no questions), parallelograms for input/output, and arrows to show the flow of execution between steps.
Learn more about Flowchart โMore Flowchart Examples
Example 1 easy
Name the four standard flowchart symbols and what each represents.
Example 3 mediumDescribe the flowchart for a program that reads a number and outputs whether it is positive, negativ
Example 4 hardCompare the strengths and weaknesses of flowcharts vs pseudocode for designing algorithms. When woul