topic badge
New Zealand
Level 6 - NCEA Level 1

Flow Charts

Lesson

 

Flow charts are diagrammatic ways to represent a list of actions that happen and the order they happen in.

To introduce the idea we will look at simple flow charts that use just 3 different shapes.

Ovals, are used to show the beginning and end.

Rectangles are used to convey actions

Diamonds are used to indicate decisions that need to be made. You can think of these as questions.

We connect these shapes with arrows to show the order we move through the flow chart.

Here is an example.

Can you see what this flow chart is describing? We read the flow chart by starting at the START and following the arrows.  You do the ACTIONS that are described until you reach the END.  

A sequence of steps

This is an example of a linear sequence, it moves from beginning to end in one straight line. There are no decisions in this flow chart, just a sequence of steps to undertake.

This particular flow chart is describing one of the multiplication strategies we can use if we want to multiply by $5$5. The strategy is the start with the number, then multiply by $10$10 and then halve. 

So to multiply $7$7 by $5$5, we can 

  • START with $7$7
  • Multiply by $10$10 to get $70$70
  • Halve $70$70 to get $35$35.
  • And this is the END.

So multiplying $7$7 by $5$5 we get $35$35

Follow my process and thinking on the same question, but this time using the flow chart.

 

Your turn!

Try writing your own linear flow charts for other multiplication strategies, if you can't think of your own you can try one from this list.

  • Where to multiply a number by $4$4, we double the number twice.
  • Multiplying a number by $8$8 can be done by doubling $3$3 times
  • Multiplying a number by $6$6 can be done by either doubling then tripling, or tripling then doubling 
  • Multiplying a number by nine can be done by either multiplying by $10$10 and subtracting one group, or tripling the number twice. 

 

Branches

Whenever we need to make a decision our flow chart branches out.

Check out this flow chart.

What is the flow chart designed to describe?

This flow chart has a decision, remember that the decisions are in the diamonds.  The answer to a decision can be yes/no, or true/false etc.  In this case, our TRUE answer resulted in an action and the FALSE answer resulted in the Stop command. 

We could introduce an action after the no answer if we wanted to. What sort of actions could that be? What actions suit this context?

Because the decision has a yes or no answer, this creates what we call a branch in our flow chart.  

 

Special Actions

Print

In some flow charts we might want to PRINT, the number or answer.  This could be on a computer screen, on a piece of paper or just to have the person write the number down in their book.

This flow chart says to select a number, add 5 and then print the answer. 

 

Set

Sometimes we set a word to mean "whatever number we chose".  For example, I could say SET $NUMBER=5$NUMBER=5, and it would mean that the word number is always understood to be the value of $5$5.  Computers like this because the next time we run the flow chart, the word NUMBER could mean 7 or 10, or any other number, but the code that has been written can always refer to the word number and then the computer always knows what to do. 

 

Loops

The final thing we will look at in this section is a loop.  Just like when you make a loop out of wire and you can trace your finger around and around the loop, so too loops in algorithms mean we can go around and around, until the code tells us to stop. 

Follow this flow chart through from the START and determine what it is trying to achieve.

 

What did you get after following this flow chart?

You would have PRINTed (written down) the numbers from 1 up to 10 on your page, one at a time as you were working through the loop. 

How could you change this flow chart to just print the numbers 1-5?, or the numbers 5-10?.  What could we do/change or add to print the numbers 2,4,6,8,10 or the 5 times tables up to 50.

Worked Examples

Question 1

Which of the following flowcharts contains a loop?

  1. A

    B

    C

    D

QUESTION 2

What is the output of this algorithm if the input is $4$4?

QUESTION 3

What is the output of this algorithm if the input is $A=2$A=2 and $B=5$B=5?

 

What is Mathspace

About Mathspace