|
The check digit is a particularly important method of validation. It is used to ensure that code numbers that are originally produced by a computer are re-entered into another computer correctly. The check digit is a single digit added onto the end of a code number by the computer. The check digit is calculated from the other digits in the number. Check digits are included in bar code numbers.
This procedure is used to generate a check digit to add to the end of a number. It uses the Modulo-11 weighted check digit calculation. This calculation is used for ISBN numbers on books.
1) | Start with the original product number e.g. 185813415. | |||||||||||||||||||||||||||||||||
2) | Weight each digit by its position in the string and add up the results. Note that the
lowest weight used is 2 :
|
|||||||||||||||||||||||||||||||||
  | ||||||||||||||||||||||||||||||||||
3) | Divide the total by 11 and then subtract the remainder from 11. The check digit is
the result of this operation :
|
|||||||||||||||||||||||||||||||||
4) | Add the check digit to the end of the original number to get the complete product number : 1858134143 |
Validating a Number Including a Check Digit
The procedure to check if a number with a check digit in it has been inputted correctly is similar to that used to generated the check digit :
1) | Input the number including the check digit. e.g. 1858134153. | ||||||||||||||||||||||||||||||||||||
2) | Weight each digit by its position in the string and add up the results :
|
||||||||||||||||||||||||||||||||||||
  | If the last digit in the number is an X then it is treated as the number 10. | ||||||||||||||||||||||||||||||||||||
3) | Divide the total by 11.
| ||||||||||||||||||||||||||||||||||||
4) | If the reminder is 0 then the number has passed the validation check and so it is likely that it has been inputted correctly. |
It is important that each digit is weighted before the numbers are added up. If this was not done then a check digit would not detect transposition errors (where two digits are swapped around). This is a particularly common form of error when numbers are typed.
GCSE ICT Companion 04 - (C) P Meakin 2004