Create and interpret flowcharts
4 Algorithms and Flowcharts
Objective: Create and interpret flowcharts
A flowchart is like a road map for a computer program. It shows the steps and decisions that the program will follow, just like a recipe tells you what to do next when cooking.
1️⃣ What is an Algorithm?
An algorithm is a clear, step‑by‑step set of instructions that solves a problem or performs a task. Think of it as a recipe:
- Ingredients (input data)
- Steps (operations)
- Result (output)
Example: Finding the larger of two numbers
- Take two numbers, A and B.
- Compare A and B.
- If A > B, output A; otherwise output B.
2️⃣ Flowchart Symbols
| Symbol | Meaning |
|---|---|
| 🟢 | Start/End |
| 🟠 | Process/Action |
| 🔺 | Decision (Yes/No) |
| ↔️ | Input/Output |
3️⃣ Creating a Flowchart: Step‑by‑Step
- 🔍 Identify the problem you want to solve.
- 📋 Write down the inputs and outputs.
- 🧩 Break the problem into simple actions (processes).
- 🛤️ Decide where you need a decision point (e.g., if‑else).
- 🖊️ Draw the flowchart using the symbols above.
- 🔄 Check the flow for any missing steps or loops.
- ?? Test the flowchart with sample data.
4️⃣ Example Flowchart: Calculate the Average of Three Numbers
| Step | Action |
|---|---|
| 1️⃣ | Start (🟢) |
| 2️⃣ | Input numbers A, B, C (↔️) |
| 3️⃣ | Sum = A + B + C (🟠) |
| 4️⃣ | Average = Sum / 3 (🟠) |
| 5️⃣ | Output Average (↔️) |
| 6️⃣ | End (🟢) |
5️⃣ Interpreting a Flowchart
Reading a flowchart is like following a choose‑your‑own‑adventure book. You start at the top, follow the arrows, and make decisions when you see a diamond (decision symbol). Each arrow tells you the next step.
Example: Deciding whether to bring an umbrella
- Check the weather forecast (🔺 Decision).
- If it says rainy, go to step 2.
- If it says clear, skip to step 3.
- Take an umbrella (🟠).
- Leave the house (🟠).
- End (🟢).
6️⃣ Tips for Clear Flowcharts
- 🖍️ Use consistent symbols throughout.
- 🔗 Keep arrows straight and avoid crossing lines.
- 📏 Label each step clearly.
- 🧩 Break complex tasks into smaller sub‑flowcharts.
- 🔁 Use loops only when necessary.
7️⃣ Practice Challenge
Try creating a flowchart for the following problem:
Determine whether a given year is a leap year (i.e., divisible by 4, but not by 100 unless also divisible by 400).
Remember to use the decision symbol for each check and label your steps clearly. Good luck! 🚀
Revision
Log in to practice.