Worksheets › Class 9 › Algorithms and Flowcharts › Cheat sheet
Class 9 Algorithms and Flowcharts: cheat sheet
CBSE Computational Thinking and AI. An algorithm is a finite list of exact steps; a flowchart draws it with standard symbols. Tracing follows the values step by step to find the output or a bug.
Key ideas
- Each flowchart symbol has one job, and arrows show the order in which the steps are carried out.
- To trace an algorithm, keep a table of every variable and update it after each step.
- A loop goes back to a decision step; it stops the first time the condition sends it on, so check the condition every round.
- Swapping two values needs a spare variable T, or the trick A = A + B, B = A − B, A = A − B.
- Taking the last digit (N mod 10) and removing it (whole part of N ÷ 10) lets a loop add or reverse digits.
- Debugging: run the algorithm on a small input, compare with the right answer, and find the first step that goes wrong.
Remember
| Oval | start or stop |
| Parallelogram | input or output |
| Rectangle | a process, such as a calculation |
| Diamond | a decision with a yes or no answer |
| Arrow; small circle | direction of flow; connector |
| Swap with a spare | T = A, A = B, B = T |
| Reverse digits | R = R × 10 + last digit of N, then remove that digit (1234 → 4321) |
Watch out
- Using > where the algorithm says ≥ (or the other way): the loop runs one time more or less.
- Starting a total at 1 instead of 0 (a product starts at 1).
- Writing A = B, B = A to swap: both end up equal to the old B.
Worked example
Put the steps of an algorithm for charging a tablet in order. Write the letters in order. (a) Find the charger (b) Check that the charging sign appears (c) Plug the charger into the socket (d) Connect the cable to the tablet (e) Switch on the socket
Working: Find the charger → Plug the charger into the socket → Connect the cable to the tablet → Switch on the socket → Check that the charging sign appears
Answer: a, c, d, e, b
Practise Algorithms and Flowcharts
Revise with this page, then practise: every Algorithms and Flowcharts sheet in the app is new, with an answer key and working.
Coming soon for Android and iPhone.