GCSE · Computer Science · AQA · Spec 8525
Integer division and remainder
135 minutes is 2 hours 15 minutes. You just got two answers from one division without blinking. A program can't: it needs a different operator for each.
Computer Science · Algorithms
Trace table — dry run the code
135 minutes: how many hours and minutes is that? Predict each new value before you press Next.
Ready when you are — step through one line at a time.
Same idea, different symbols
Which operation is it?
Which operation does each operator do? (Every example uses 22 and 4.)
Still to sort
Integer division (0)
How many whole times the second number fits into the first.
Where the line is: Integer division and remainder come from the same division, but integer division counts the whole groups while remainder counts what's left.
Remainder (0)
What's left over after the whole groups are taken away.
Real division (0)
Ordinary division that keeps the fractional part.
Where the line is: Real division gives 5.5; integer division gives just the whole 5 and drops the .5.
Pseudo-code and Python write these operations differently. Sort each operator by what it actually returns.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
One division, two whole-number answers: how many times it fits, and what's left over.
What you need to know
- Real division (/) keeps the fraction: 17 / 5 = 3.4.
- Integer division (DIV) keeps only the whole number of fives that fit: 17 DIV 5 = 3. It never rounds.
- The remainder (MOD, also called modulus) is what's left over: 5 × 3 = 15, and 17 − 15 = 2, so 17 MOD 5 = 2.
Have a goYour mate's calculator says 29 / 8 = 3.625, so they proudly write 29 DIV 8 = 4. Rescue them: what are 29 DIV 8 and 29 MOD 8 really?
29 DIV 8 = 3 and 29 MOD 8 = 5.
Three eights make 24 and a fourth would need 32, so DIV is 3, not 4 — rounding 3.625 is the trap. Then 29 − 24 = 5 is left over.
- Don't read the remainder off the decimal. The .4 in 3.4 is a fraction of a five, not a leftover count.
- They always fit together: a = b × (a DIV b) + (a MOD b). Here, 17 = 5 × 3 + 2.
Have a goA program lost its starting number x. All you know is x DIV 6 = 4 and x MOD 6 = 1. Rebuild x.
x = 25
6 × 4 + 1 = 24 + 1 = 25. Stopping at 24 forgets the 1 left over, and 24 would have a remainder of 0.
- Divides exactly? Then nothing is left over: 20 MOD 5 = 0.
- First number smaller than the second? DIV gives 0 and MOD hands back the first number: 3 DIV 5 = 0, 3 MOD 5 = 3.
Have a goNo working allowed: what are 40 MOD 8 and 8 MOD 40?
40 MOD 8 = 0 and 8 MOD 40 = 8.
8 fits into 40 exactly (five times), so nothing's left; 40 fits into 8 zero times, so all 8 are left. Saying 0 for both mixes up the two special cases.
- Many pseudo-codes write DIV and MOD; Python writes // and %. Learn the operation, not the symbol.
- Remainder 0 makes a test: n MOD 2 = 0 means n is even; n MOD k = 0 means n is a multiple of k.
- Splitting units takes both: 135 DIV 60 gives 2 hours, and 135 MOD 60 gives the 15 minutes left.
The big picture
Integer division (DIV, or // in Python) gives the whole number of times one number fits into another and throws any fraction away. The remainder (MOD, or % in Python) gives what's left over. Both are different from real division (/), which keeps the fraction, and together they fit a = b × (a DIV b) + (a MOD b). Programs use them to split a quantity into bigger and smaller units and to test whether one number divides another exactly.
Key points
Worked example
Problem
A program packs 75 eggs into boxes of 6. Write the two lines that store the number of full boxes and the number of eggs left over, and give their values.
⚠ Watch out
Reading the remainder off a calculator. 14 / 4 = 3.5, so 14 MOD 4 must be 5, right? Nope. Four fours make 12, so the remainder is 14 − 12 = 2. The .5 is half a four, not 5 of anything.
Memory hook
DIV counts the full boxes. MOD counts what's still in your hands.
Check yourself
Without a calculator, work out 44 DIV 7, 44 MOD 7, 5 DIV 12 and 5 MOD 12. Then check each pair with divisor × DIV answer + MOD answer.
Flashcards
(12)What does a DIV b give?
What does a MOD b give?
7 / 2 compared with 7 DIV 2?
Why is 19 DIV 5 equal to 3, not 4?
23 / 4 = 5.75. So is 23 MOD 4 equal to 75?
How are a, b, a DIV b and a MOD b linked?
What is a MOD b when b divides a exactly?
If a is smaller than b, what are a DIV b and a MOD b?
Python symbols for integer division and remainder?
What does a single / do in pseudo-code and Python?
How can a program test whether n is even?
How can a program test whether n is a multiple of k?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore AQA GCSE Computer Science topics
- Greater than (relational operator)
- Greater than or equal to (relational operator)
- Identifying and categorising errors
- Indefinite (condition-controlled) iteration
- Integer / real to string conversion
- Integer data type
- Iteration
- Keyboard input
- Less than (relational operator)
- Less than or equal to (relational operator)
- Local variables
- Logic errors
How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 28 October 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.