Add two number in Scratch

brainly

bindroomonika01 is waiting for your help.

Add your answer and earn points.

Answer

No one rated this answer yet — why not be the first? 😎
  • Ambitious
  • 15 answers
  • 961 people helped

Answer:

Here's an example scratch program for finding the sum of two numbers.

Explanation:

First, drag and drop two "ask" blocks from the “Sensing” category and place them below the “when green flag clicked” block.

Change the prompt text on both ask blocks to "Enter a number" and "Enter another number".

Drag and drop a "set" block from the “Variables” category, and change the variable name to "num1". Place it under the first "ask" block, and set its value to "answer".

Repeat step 3, but change the variable name to "num2" and place it under the second "ask" block.

Add a "join" block and connect it to a "set" block.

Inside the "join" block, type in "sum:" followed by a space.

Drag out the "num1" variable block and place it next to the colon in the "join" block.

Add a "+" operator block and place it next to the "num1" block.

Drag out the "num2" variable block and place it next to the "+" operator block.

Finally, drag and drop a "say" block from the “Looks” category, and connect it to the "join" block.

Here is what the final program should look like:

when green flag clicked

ask "Enter a number" and wait

set num1 to (answer)

ask "Enter another number" and wait

set num2 to (answer)

join "sum: " (num1 + num2)

say [result v]

When you run this program, it will prompt the user to enter two numbers, add them together, and then display the sum as "sum: [result]" where [result] is the actual sum of the two numbers.

Comments

Popular posts from this blog

Change constume of a sprite