# 14.04 Flow charts

Lesson

## Are you ready?

Do you remember what an iteration is? Try this question.

### Examples

#### Example 1

Follow the algorithm below to fill in the results.

Worked Solution
Create a strategy

Follow each step of the algorithm.

Apply the idea

Step 1 tells us to start with 29, so the first result is 29.

Step 2 tells us to subtract 1 from 29, which gives us 29-1=28.

Step 3 tells us to repeat step 2 three more times. Since step 2 tells us to subtract 1, we need to subtract 1 three times to get: 27,\,26,\,25.

Step 4 tells us to double the last number found in step 3, which is 25.

Idea summary

Iteration means to repeat steps in an algorithm.

## Flow charts

This video shows us how to set up and follow a flow chart.

### Examples

#### Example 2

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

Worked Solution
Create a strategy

Use the given number as the input and follow each instruction in the flow chart.

Apply the idea
Idea summary

A linear sequence is a flow chart that moves from beginning to end in one straight line. There are no decisions, just a some steps to do.

## Branches, loops and print

We can show all our special coding things in a flow chart. This video shows us branches, loops and some special functions like print and set.

### Examples

#### Example 3

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

Worked Solution
Create a strategy

Use the given numbers for A and B and follow the flow chart.

Apply the idea
Idea summary

On a flow chart:

• Branch is shown by two arrows coming out of a decision box.

• Iteration is shown as a path that loops back to itself.

• Print can be used to display an output.

### Outcomes

#### VCMNA221

Design algorithms involving branching and iteration to solve specific classes of mathematical problems