# 12 digit product codes: Check if total is a multiple of 10 (entered one at a time)

Challenge Level: Growing experience

Learning outcomes

Students will be able to:

## Requirement:

Write a program that asks the user to enter a 12 digit product code, entering each digit one at a time. Then adds up all the digits, every second one multiplied by 3 (1st, 3rd, and so on) and show if this total is a multiple of 10 or not.

## Testing examples:

Your program should display the outputs shown in this table for the given inputs provided:

Example

Input

Enter digit 1 of the product code:
8

Enter digit 2 of the product code:
3

Enter digit 3 of the product code:
8

Enter digit 4 of the product code:
3

Enter digit 5 of the product code:
1

Enter digit 6 of the product code:
0

Enter digit 7 of the product code:
0

Enter digit 8 of the product code:
2

Enter digit 9 of the product code:
2

Enter digit 10 of the product code:
5

Enter digit 11 of the product code:
2

Enter digit 12 of the product code:
4

Output

The sum is a multiple of 10

## Languages

Scratch

#### What it should look like

Click on the green flag, enter the inputs provided in the “testing examples” to see the expected output of your program.

Recommended blocks
when green flag clicked

say (join [Total: ] (total))
repeat (6)
end
ask (join (join [Enter digit ] (counter)) [ of the product code:]) and wait

ask (join (join [Enter digit ] (counter)) [ of the product code:]) and wait
set [total 1 v] to [0]

set [total 2 v] to [0]

set [counter v] to [1]

change [counter v] by (1)

change [total 1 v] by (answer)

change [counter v] by (1)

change [total 2 v] by (answer)

set [total v] to (((total 1) * (3)) + (total 2))
Hints
• You need to add up 1st, 3rd, 5th and so on digits and store the result in a variable called total 1. Then add up 2nd, 4th, 6th and so on digits and store the result in variable called total 2. The output is the sum of total 1 multiplied by 3 and total 2.