AQA GCSE CSPaper 1 · Unit 2Lesson 5

Paper 1 · Unit 2 · CS-L2-05

Arithmetic Operations

60 minutes · AQA 8525 · Paper 1 — Programming

Spec & Goals 3 min

AQA Spec 3.2.3 · Arithmetic operations

By the end of this lesson you can:

  1. Use the arithmetic operators + * / in AQA pseudo-code and Python.
  2. Apply integer division DIV and modulus MOD, and distinguish real from integer division.
  3. Use MOD to test divisibility, such as whether a number is even.

Warm-Up 5 min

Last lesson you used iterationFOR, 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.

OperatorMeaningExample
+Addition4 + 3 gives 7
Subtraction4 − 3 gives 1
*Multiplication4 * 3 gives 12
/Division (real)17 / 5 gives 3.4
DIVInteger division (whole quotient)17 DIV 5 gives 3
MODModulus (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:

StepCalculationResult
Whole minutes200 DIV 603
Leftover seconds200 MOD 6020

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

🟢 Easy

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.

🟡 Medium

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.

🔴 Stretch

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[1 mark]

Calculate the value of 23 DIV 4.

Mark scheme
  • 5 (1) — the whole-number quotient, remainder discarded.
Calculate[1 mark]

Calculate the value of 23 MOD 4.

Mark scheme
  • 3 (1) — the remainder, because 4 × 5 + 3 = 23.
Explain[2 marks]

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 0 the number is even (otherwise it is odd) (1).
Evaluate[2 marks]

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 +, * or MOD.
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).