Learn
Variables
Arithmetic Operators

Computers are incredible at doing calculations. Now that we have declared variables, letâ€™s use them with arithmetic operators to calculate things!

Here are some arithmetic operators:

• + addition
• - subtraction
• * multiplication
• / division
• % modulo (divides and gives the remainder)

For example:

var score = 0
// score is 0

score = 4 + 2
// it is now 6

score = score - 2
// it is now 4

score = 4 * 2
// it is now 8

score = 4 / 2
// and now 2

score = 5 % 2
// and now 1

Note: The order of operations can be specified using parentheses. For example, the use of parentheses in score = 4 * (2 + 1) sets score equal to 4 * 3 rather than 8 + 1.

### Instructions

1.

In the code editor, we have already declared and initialized a variable called amount.

Declare a new variable named tip and give it the value of amount multiplied by 0.2.

2.

Now print out tip.

How much is the tip?

# Take this course for free

## Or sign up using:

Already have an account?