# Coding in the Classroom ┃Grade 5 – Addition Game – Solutions

Part 1 – Creating an Addition Program in Scratch

Questions

1 – What are the names of the three variables used in this program?

num1, num2, sum

2 – What information does each of these variables contain?

num1 – the first number entered by the user

num2 – the second number entered by the user

sum – the sum of the first and the second numbers

3 – Does the order of the lines of code matter?

Yes – if the blocks, or lines of code, were in a different order, the program will not run properly. We couldn’t add the numbers for instance before obtaining the numbers from the user.

Extensions

1 –  Change the application to a Multiplication Program. The symbol * means to multiply in the coding world. Remember to change the name of your sum variable to what the answer is called in a multiplication statement.

Screen print of code:

2 – Add a third variable called num3 and make it so the user will enter in three numbers, rather than 2.

Screen print of code:

Part 2 – Creating a simple Addition Game in Scratch

Questions

1 -What are the names of the four variables used in this program?

2 – What information does each of these variables contain?

num1 – a random number between 0 and 10

num2 – a random number between 0 and 10

sum – the sum of the two numbers

3 – What is the range of random numbers that num1 and num2 might be?

Between 0 and 10 (0,1,2,3,4,5,6,7,8,9,10)

4 – Based on the current range for num1 and num2 variables, what is the lowest and highest number that the sum variable value can be?

0, 20

Extensions:

1 – Change this game to a multiplication game.

Screen print of code:

2 – Alter the code so that the range for the variable values of num1 and num2 is between 0 and 100.

Screen print of code:

3 – Add a repeat so that once the user answers, new numbers appear.

Screen print of code:

4 – Add a new variable to keep track of the number of correct answers – and this is outputted to the user after each question is answered.

Screen print of code (possible solution):

5 – Add two more variables so that you can keep track of the number of questions, correct answers and percentage answered correctly. Display this information to the user by displaying the variables.

Screen print of code (possible solution):

6 – Write pseudocode for a program that does the following:

• Asks the user their age
• Tells them whether they are old enough to vote
Scroll to Top