Integer Variables

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

Declare an Integer Variable

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

Your program should output the following text.

Example integer: 42

Using the Addition Operator

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

Sum: 35

Making a Counter

In programming, you often see common patterns in the code. One of these patterns is called a counter. While you haven't needed them yet, you will when you begin working with loops that repeat actions.

In this program, edit the counter block on both sides of the equal so that the integer variable, result, is one more than its original value. When you run your program it should output the following text.

Result: 43

Using the Subtraction Operator

Create a program that results in a difference of 33. Read the program and add the difference operator block with the following output.

Difference: 33

Using the Multiplication Operator

Create a program that results in a product of 492. Read the program and add the block that will produce the following output.

Product: 492

Using the Division Operator

Create a program that results in a Quotient of 5. Read the program and add the block that will produce the following output.

Quotient: 5

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 integer variables for the sum, difference, product, and quotient. Then output the results in the following format.

Sum: 49
Difference: 15
Product: 544
Quotient: 1

Division with Integers

Division sometimes results in a number that is not a whole number. Find the result, take the floor of the result, and move each block so the program displays the correct answer after each question.

Using the Modulo Operator

Create a program that results in a Remainder of 2. Read the program and add the block that will produce the following output.

Remainder: 2

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 by using the keyboard. Once the output block has the focus, select the left or right arrows to begin editing the text. 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.