Checking a number with its check digit on entry
Work out the check digit again from the other digits, then compare it with the one entered. If they differ, reject the number and ask the user to re-enter it.
Understanding Checking a number with its check digit on entry in IGCSE Computer Science Paper 1
What it does: A mismatch means the number was probably mistyped, so the program shows a message asking the user to enter it again. The first 12 digits have a weighted total of 93, so the check digit is 10 - 3 = 7. It equals the entered check digit, so no error is found. Any difference between the two check digits means the number is rejected. The system does not accept it just because most of the digits look right. The check digit is the amount needed to reach the next multiple of 10. 93 + 7 = 100, so the check digit is 7, which matches the ISBN.
Common mistakes: The check digit must be recalculated from the other digits with CheckDigit(code). Reusing the entered last digit means calc always equals entered, so errors are never found. The valid ISBN-13 has 13 digits and ends in the check digit 7. The broken line drops that last digit, so there is no entered check digit to compare with. It should be "9780306406157".
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 179–188) and word search (Modules 168–188).
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
recalculate and compareFill in the Blanks
Spot the Error
Student with a class code? Join your class →