Flowchart CS Thinking Example 3

Follow the full solution, then compare it with the other examples linked below.

Example 3

medium
Describe the flowchart for a program that reads a number and outputs whether it is positive, negative, or zero.

Solution

  1. 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. 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