AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Numbers on the board

Week 18 · Unit 8: Be an innovator · 3 lessons
1

Four operators

Computing 6: Unit 8, pp. 106–123
GoalUse the four arithmetic operators in micro:bit blocks and predict what the display shows.
New words
operator · a symbol or block that does a calculation, such as + or ×result · the answer that a calculation givesmicro:bit · a small programmable board with a grid of 25 lights, two buttons and sensorsshow number · a block that scrolls a number across the lights of the board
Explanation

An arithmetic operator tells a computer how to combine two numbers. There are four. Add (+) finds a total. Subtract (−) finds a difference. Multiply (×) repeats an amount. Divide (÷) shares an amount equally. In typed code the symbols for multiply and divide are often * and /, because × and ÷ are not on most keyboards. In micro:bit blocks the operators fit into a slot like the pieces of a puzzle. A program usually works out a result, keeps it in a variable and then shows it with show number. When a number has two or more digits, the lights scroll it across the board one digit at a time. A block that sits inside another is worked out first, and this decides the order of a calculation.

setato36setbto4setresulttoa÷bshow numberresulton buttonApressed
Worked examples
OperatorOn paperBlockExampleBoard shows
add+(a) + (b)16 + 925
subtract−(a) − (b)40 − 1723
multiply×(a) × (b)6 × 742
divide÷(a) ÷ (b)45 ÷ 59
These four small programs each use one operator. After each press of the button the board scrolls the result. The answers are worked out in the blocks, not by the person.
Program 1show number3+4×2on buttonApressedProgram 2show number3+4×2on buttonApressed
The nesting of the blocks decides the order. In the first program the multiplication is inside the addition, so it is worked out first: 4 × 2 = 8, and then 3 + 8 = 11. In the second program the addition is inside the multiplication: 3 + 4 = 7, and then 7 × 2 = 14.
ProblemCalculationOperator
5 books at 8 each5 × 8 = 40multiply
pay 50 for a bill of 3850 − 38 = 12subtract
share a bill of 36 between 436 ÷ 4 = 9divide
Operators solve everyday problems. A shop multiplies the price by the number bought, subtracts the payment from the total to find the change and divides a bill to share it.
Class activity

Operator cards (no computer): make four cards with +, −, ×, ÷ and several number cards 1 to 12. Two players draw two number cards and one operator card. Each says the answer. A third player acts as the micro:bit and says ‘The board shows …’ only when the calculation is right. Use a check of 12 ÷ 4 = 3 and 4 × 3 = 12 to see how multiply and divide undo each other. Keep score. If you have a computer or tablet, build one of the programs in a micro:bit simulator.

Practice
1
What does the board show after A is pressed in each program?
Program Asetxto18setyto7show numberx+yon buttonApressedProgram Bsetxto50setyto19show numberx−yon buttonApressedProgram Csetxto8setyto9show numberx×yon buttonApressed
2
Which program shows 23 and which shows 33?
Program 1show number5+6×3on buttonApressedProgram 2show number5+6×3on buttonApressed
3
Write the blocks for a program that shows 9 times 6 when the button B is pressed. What does it show?
4
Which operator would you use to (a) find how many in 4 packs of 12, (b) find the difference between 70 and 45, (c) share 30 sweets between 5 friends?