Number Variables

A group of problems that help you to practice declaring, assigning, and using variables with a type of number.

Declare a Number Variable

Declare the number variable and then output the value of it. Then run your program.

Your program should output the following text.

Example number: 15.8

Using the Addition Operator

Create a program that results in a sum of 57.9. Read through the program and add the sum operator block with the following output.

Sum: 57.9

Using the Subtraction Operator

Read the program and add the difference operator block with the following output.

Difference: 11.9

Using the Multiplication Operator

Read the program and add the multiply operator block with the following output.

Product: 7.25

Using the Division Operator

Read the program and add the divide operator block with the following output.

Quotient: 4.0

Practice with Operators

Finish this program that outputs the result of adding, subtracting, multiplying, and dividing the two variables, a and b.

Read the blocks provided in this this program. Then add the basic blocks to store four number variables for the sum, difference, product, and quotient. Then output the results in the following format.

Sum: 37.25
Difference: -9.75
Product: 323.125
Quotient: 1.709090909090909

Mixing Number and Integer Values

The following program has a problem that needs to be fixed. Read the program and think about the result you expect. Then run the program. Did the result match your expectations?

Edit the program so that when it is run the program outputs the following text.

Result: 1.25

Using the Modulo Operator

Read the program and add the block that will produce the following output.

Remainder: 1.25

Expressions and Order of Operations

In this task, read the two expressions in this program and decide the result for each. Then enter your answers in the output blocks. Run the program to see if your answers match the program.

Comparison Operators

In this task, read the four expressions in this program and decide whether each is a true or false statement. Then drag over the correct answer block. Run the program and select the check button to see if you are right.

Comparison Operators and Logic

In this task, read the four expressions in this program and decide whether each is a true or false statement. Then drag over the correct answer block. Run the program and select the check button to see if you are right.