Spec & Goals 3 min
AQA Spec 3.2.3 · Arithmetic operations
By the end of this lesson you can:
- Use the arithmetic operators
+−*/in AQA pseudo-code and Python. - Apply integer division
DIVand modulusMOD, and distinguish real from integer division. - Use
MODto test divisibility, such as whether a number is even.
Warm-Up 5 min
Last lesson you used iteration — FOR, WHILE and REPEAT loops — to repeat steps. Today we do the maths inside those steps.
Quick starter
A teh tarik stall sells drinks in packs of 6. Aisyah has 17 cups to box up.
- How many full packs of 6 can she make?
- How many cups are left over?
Reveal the answer
Two full packs (17 DIV 6 = 2), with 5 cups left over (17 MOD 6 = 5). Those two operators are exactly what this lesson is about.
Key Concept — operators, DIV and MOD 14 min
An operator is a symbol that performs an operation on values. The four basic arithmetic operators work the same in AQA pseudo-code as in everyday maths.
| Operator | Meaning | Example |
|---|---|---|
+ | Addition | 4 + 3 gives 7 |
− | Subtraction | 4 − 3 gives 1 |
* | Multiplication | 4 * 3 gives 12 |
/ | Division (real) | 17 / 5 gives 3.4 |
DIV | Integer division (whole quotient) | 17 DIV 5 gives 3 |
MOD | Modulus (remainder) | 17 MOD 5 gives 2 |
Real division vs integer division
Real division with / keeps the fractional part: 17 / 5 = 3.4. Integer division with DIV throws away the fraction and keeps only the whole-number quotient: 17 DIV 5 = 3.
Together they split a division cleanly: 17 DIV 5 = 3 and 17 MOD 5 = 2, because 5 × 3 + 2 = 17.
Worked Example — total seconds to minutes and seconds 12 min
Problem: input a number of seconds and output it as whole minutes and the remaining seconds. For example, 200 seconds is 3 minutes and 20 seconds.
Decompose: (1) read the total, (2) find whole minutes with DIV 60, (3) find leftover seconds with MOD 60, (4) output both.
AQA pseudo-code
totalSeconds ← USERINPUT minutes ← totalSeconds DIV 60 seconds ← totalSeconds MOD 60 OUTPUT minutes OUTPUT seconds
Trace it with totalSeconds = 200:
| Step | Calculation | Result |
|---|---|---|
| Whole minutes | 200 DIV 60 | 3 |
| Leftover seconds | 200 MOD 60 | 20 |
So the program outputs 3 then 20 — that is 3 minutes and 20 seconds.
The same algorithm in Python
total_seconds = int(input("Enter seconds: ")) minutes = total_seconds // 60 seconds = total_seconds % 60 print(minutes) print(seconds)
In Python, // is integer division (the same as DIV) and % is modulus (the same as MOD).
Try It Yourself 12 min
Goal: Write AQA pseudo-code that inputs two prices in ringgit and outputs their total.
Hint: read both with USERINPUT, add them with +, then OUTPUT the total.
Goal: Write pseudo-code that inputs a number of eggs and outputs how many full cartons of 12 can be filled, and how many eggs are left over.
Hint: use eggs DIV 12 and eggs MOD 12.
Goal: Write pseudo-code that inputs a whole number and outputs 'Even' or 'Odd' using MOD inside an IF … THEN … ELSE … ENDIF.
📝 Exam Practice 10 min
Answer the way the examiner expects — the command word and the marks tell you how much to write.
Calculate the value of 23 DIV 4.
Mark scheme
5(1) — the whole-number quotient, remainder discarded.
Calculate the value of 23 MOD 4.
Mark scheme
3(1) — the remainder, because4 × 5 + 3 = 23.
Explain how the MOD operator can be used to test whether a number is even.
Mark scheme
- Compute
n MOD 2— the remainder when the number is divided by 2 (1). - If the result is
0the number is even (otherwise it is odd) (1).
State the value of each expression: 9 DIV 2 and 9 MOD 2.
Mark scheme
9 DIV 2 = 4(1).9 MOD 2 = 1(1).
Recap & Key Terms 3 min
Arithmetic uses + − * /. Real division keeps the fraction; DIV keeps only the whole quotient and MOD keeps the remainder. MOD is the quick way to test divisibility, such as even or odd.
- Operator
- A symbol that carries out an operation on values, such as
+,*orMOD. - DIV
- Integer division — the whole-number quotient, with the remainder discarded (e.g.
17 DIV 5 = 3). - MOD
- Modulus — the remainder left after integer division (e.g.
17 MOD 5 = 2).
Homework 1 min
Task (≤ 15 min): Write, in AQA pseudo-code, an algorithm that inputs a number of total minutes and outputs whole hours and the remaining minutes.
Model answer
totalMinutes ← USERINPUT hours ← totalMinutes DIV 60 minutes ← totalMinutes MOD 60 OUTPUT hours OUTPUT minutes
Award marks for: read the input (1), DIV 60 for hours (1), MOD 60 for the leftover minutes (1), output both (1).