Flowchart CS Thinking Example 3
Follow the full solution, then compare it with the other examples linked below.
Example 3
mediumDescribe the flowchart for a program that reads a number and outputs whether it is positive, negative, or zero.
Solution
- 1 Step 1: Start โ Input number โ Decision: number > 0? โ Yes: Output 'Positive' โ End. No: Decision: number < 0? โ Yes: Output 'Negative' โ End. No: Output 'Zero' โ End.
- 2 Step 2: This shows two diamonds (decisions) in sequence, creating three possible paths through the flowchart.
Answer
Two decision diamonds: first checks > 0, then < 0. Three paths lead to 'Positive', 'Negative', or 'Zero'.
Nested decisions in flowcharts create multiple paths. Each path through the flowchart represents one possible execution of the program, making all cases visible at a glance.
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 2 mediumDescribe the flowchart for a program that keeps asking the user to enter a password until they enter
Example 4 hardCompare the strengths and weaknesses of flowcharts vs pseudocode for designing algorithms. When woul