topic badge
CanadaON
Grade 7

15.03 Branching

Worksheet
Branching
1

Follow the algorithm below for each of the following numbers:

  • If the number is even, halve it.

  • If the number is odd, subtract one and halve it.

a

Start with the number 8.

b

Start with the number 11.

2

Follow the algorithm below for each of the following numbers:

  • If the number is bigger than 20, subtract 10.

  • If the number is less than 20, add 10.

a

Start with the number 14.

b

Start with the number 35.

3

Follow the algorithm below starting with the number 10:

  • If the number is more than 40, add 1.

  • If the number is less than 40, double it.

4

Follow the algorithm below starting with the number 45:

  • If the number is more than 40, add 4.

  • If the number is less than 40, double it.

5

Follow the algorithm below starting with the number 11:

  • If the number is even, add 5 then double it.

  • If the number is odd, double it then add 5.

6

Follow the algorithm below starting with the number 8:

  • If the number is even, add 7 then double it.

  • If the number is odd, double it then add 7.

7

Follow the algorithm below starting with the number 72:

  • If the number is less than 100, multiply it by 10 then add 8.

  • If the number is more than 100, add 8.

8

Follow the algorithm below starting with the number 240:

  • If the number is less than 100, multiply it by 10 then add 10.

  • If the number is more than 100, add 10.

9

Consider the rounding algorithm below:

  • If the digit after the decimal point is 5 or more, round up to the next whole number.

  • If the digit after the decimal point is less than 5, write the number without the decimal part.

a

Use the algorithm to round 7.2.

b

Use the algorithm to round 3.5.

Sign up to access Worksheet
Get full access to our content with a Mathspace account

Outcomes

7.C3.1

Solve problems and create computational representations of mathematical situations by writing and executing efficient code, including code that involves events influenced by a defined count and/or sub-program and other control structures.

7.C3.2

Read and alter existing code, including code that involves events influenced by a defined count and/or sub-program and other control structures, and describe how changes to the code affect the outcomes and the efficiency of the code.

What is Mathspace

About Mathspace