Brought to you by the

*Student Advisory Board*

What is a Product Code

A unique sequence of numbers (and sometimes letters) which help identify what a product is when it is ready for sale.

Activity

You will calculate the last digit of the product code which is called the checksum and itâ€™s used when scanning the barcode at grocery stores to make sure that the code was scanned properly.

When scanned the computer does the calculations you will do in this activity and if the check digit comes out incorrect it will warn you of that.

Materials

- A writing utensil (pen, pencil, marker, etc.)
- Paper
- At least 1 household item that has a product code with either 12 or 13 digits
- Calculator (not necessary, but may be helpful)

Directions

- Count how many digits are in the product code. If there are 12 digits continue on through the rest of the steps. If there are 13 digits then skip below to Step 7.
- From left to right, read the numbers and write them on alternating lines (our example is 0 48001 20802 X). Remember to keep the last digit a secret!
- Now separately add up the numbers in the top row and the bottom row
- Take the sum of the first row and multiply it by 3
- Now take the sum of the second row and add it to the number from Step 4.
- Take the number from Step 5 and calculate the next higher multiple of 10
- Take that number from Step 6 and subtract from it the number from Step 5.
- (For a 13 digit code) The first step is the same as for a 12 digit code: you would write down the code on alternating lines (assuming that the code is 9 300644 10321X where X is the last digit we are trying to find)
- Sum up all the numbers in the first row and then all the numbers in the second row
- Take the sum of the second row found in Step 8 and multiply it by 3 (in our example this would result in 12 * 3 = 36)
- Take the number from Step 9 and add it to the sum of the first row found in Step 8 (in this case that would be 36 + 21 = 57).
- Take the number found in Step 10 and think about what number you could add to it in order to get the nearest multiple of 10 larger than it. For example, in our case we have the number 57. The nearest multiple of 10 larger than 57 is 60. 60 - 57 = 3 so 3 is the number we want. Make sure you check that the numbers that are written down are correct and that your addition is also correct!

Thanks

Support from CSE*xplore* and Department of Computer Science and Engineering at UB

Activity inspired by CSUnplugged

Return to Main 2021 Kid's Day Page

Return to Activity Landing Page