Intro to Computer Science / Unit 3: Algorithms and Problem Solving
3.4 Flowcharts Described in Words
Notes
A flowchart shows an algorithm as shapes connected by arrows. Since you may need to read them as text, learn what each shape means.
- Oval (terminator): Start or End.
- Rectangle: a process or action, such as "add 1 to count".
- Diamond: a decision with a yes/no question and two exits.
- Parallelogram: input or output.
- Arrows show the direction of flow. A loop appears when an arrow goes back to an earlier step.
- Example in words: Start, input a number, diamond "is the number even?"; if yes, output "even"; if no, output "odd"; End.
Practice
In a flowchart, which shape is used for a yes/no decision?
A diamond asks a question and has branching exits.
A flowchart says: Start, set count to 0, diamond "count less than 3?"; if yes, print count, add 1 to count, go back to the diamond; if no, End. What is printed?
count starts at 0 and prints while it is less than 3, so 0, 1, 2 are printed.
What does an arrow that leads back to an earlier step represent?
An arrow returning to an earlier step repeats part of the algorithm.
Ready for more? Take the Unit 3 test.