In this activity, we will build a simple addition calculator in PictoBlox. The program will ask the user to enter two numbers, add them together, and display the result using a sprite.
Setting Up
- Open PictoBlox and create a New File.
- Select Block Coding as the coding environment.
- Choose any sprite — we will use Tobi for this activity.
Creating the Variables
- Go to the Variables palette and click Make a Variable.
- Create a variable called Number1.
- Create another variable called Number2.
- Create a third variable called Result.
Building the Script
Now let's build the script. You will find the blocks in the mentioned palettes:
- When flag clicked — Events
- Ask (Enter the first number:) and wait — Sensing
- Set (Number1) to (answer) — Variables
- Ask (Enter the second number:) and wait — Sensing
- Set (Number2) to (answer) — Variables
- Set (Result) to (Number1 + Number2) — Variables & Operators
- Say (join (The answer is: ) (Result)) for (3) seconds — Looks & Operators

Running the Script
- Click the green flag to start the program.
- Enter the first number when prompted and press Enter.
- Enter the second number when prompted and press Enter.
- Watch Tobi display the sum of the two numbers in a speech bubble!

Challenge
Try extending the calculator to support all four operations — addition, subtraction, multiplication, and division. You could ask the user which operation they want to perform, then carry it out!
Save your file with the name Addition Calculator before moving on to the next activity!

.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)