Product code check digits programming challenges

These challenges provide students with the opportunity to exercise the ideas they have been working with around the checksums on product codes. Before assigning the challenges, you will need to check on which type of product code is common locally (particularly 12 or 13 digit), as the initial exercises are specific to the type of product code, to simplify the programming. 12-digit product codes, which are common in North America; 13-digit product codes are more common in Europe, Australia and New Zealand.

The challenges scaffold writing a program that does the basic checksum for a code, but students could enhance their program to put in extra checks, such as only digits (not letters) being typed in, and having the correct number of digits.

Number Name Challenge Level Languages
1.1 12 digit product codes: Weighted sum of digits (entered one at a time) Growing experience
1.1 13 digit product codes: Weighted sum of digits (entered one at a time) Growing experience
1.2 12 digit product codes: Check if total is a multiple of 10 (entered one at a time) Growing experience
1.2 13 digit product codes: Check if total is a multiple of 10 (entered one at a time) Growing experience
1.3 12 digit product codes: Check if total is a multiple of 10 (one line of input) Growing experience
1.3 13 digit product codes: Check if total is a multiple of 10 (one line of input) Growing experience
1.4 12 and 13 digit product codes: Check for a valid product code (any length) Ready to expand
1.5 12 digit product codes: Calculate the last digit (entered one digit at a time) Ready to expand
1.5 13 digit product codes: Calculate the last digit (entered one digit at a time) Ready to expand
1.6 12 digit product codes: Calculate the last digit (one line of input) Ready to expand
1.6 13 digit product codes: Calculate the last digit (one line of input) Ready to expand