EXAMPLE 6 Detecting and Correcting an Error

The scanner ignores the guard bars at the beginning and the end and reads the remaining bars in blocks of five, as shown below. (We have inserted dashed dividing lines for readability.)

image

The sixth block is an incorrect one because it has only one long bar. To correct the error, the computer linked with the bar-code scanner sums the remaining 9 digits to obtain 31. I Because the sum of all 10 digits ends with 0, the correct value for the sixth digit must be 9.