DIV and MOD
DIV(a, b) gives the whole-number part of a divided by b, so DIV(10, 3) is 3. MOD(a, b) gives the remainder, so MOD(10, 3) is 1. Both take integers.
Understanding DIV and MOD in IGCSE Computer Science Paper 2
What it does: An even number divides by 2 with no remainder, so MOD(Number, 2) equals 0. DIV gives the whole number of 60-minute blocks, which is the number of complete hours. MOD gives the remainder after dividing. 10 = 3 * 3 + 1, so MOD(10, 3) is 1. MOD returns the remainder. DIV returns the whole-number quotient and discards the remainder. 8 divides exactly by 2, so the remainder is 0. DIV(8, 2) would be 4. DIV(a, b) and MOD(a, b) work on integers, such as DIV(10, 3). They do not work on strings. MOD returns what is left over after dividing. 3 goes into 10 three times (9), leaving 1.
Common mistakes: The program should output the whole-number part of 10 divided by 3. MOD gives the remainder (1), not the whole part. It should be Part ← DIV(Number, 3), which gives 3. The variable holds the remainder, and the output should be 1. DIV(10, 3) gives 3, the whole-number part. The remainder needs MOD(10, 3).
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 146–155) and word search (Modules 146–165).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
DIV(a, b) and MOD(a, b)Fill in the Blanks
Spot the Error
Student with a class code? Join your class →