Arithmetic operators (performing calculations)
To perform calculations, computer programmers use arithmetic operators.
Here are some examples of calculations using arithmetic operators and variables:
Add |
| Adding the value of variable a to the value of variable called b. So if a contained 6 and b contained 2, the value 8 would be assigned to the total variable. |
Subtract |
| Subtracting the value of variable b from the value of variable called a. So if a contained 6 and b contained 2, the value 4 would be assigned to the total variable. |
Multiply |
| Multiplying the value of variable a with the value of variable b. So if a contained 6 and b contained 2, the value 12 would be assigned to the total variable. |
Divide |
| Dividing the value of variable a with the value of variable b. So if a contained 6 and b contained 2, the value 3 would be assigned to the total variable. |
Exponent |
| Raises the value of variable a to the value of variable b. So if a contained 6 and b contained 2, the value of 62 would be assigned to the total variable. In this case 62 is 36, so the value 36 is assigned to the total variable. |
Add |
|
Adding the value of variable a to the value of variable called b. So if a contained 6 and b contained 2, the value 8 would be assigned to the total variable. |
Subtract |
|
Subtracting the value of variable b from the value of variable called a. So if a contained 6 and b contained 2, the value 4 would be assigned to the total variable. |
Multiply |
|
Multiplying the value of variable a with the value of variable b. So if a contained 6 and b contained 2, the value 12 would be assigned to the total variable. |
Divide |
|
Dividing the value of variable a with the value of variable b. So if a contained 6 and b contained 2, the value 3 would be assigned to the total variable. |
Exponent |
|
Raises the value of variable a to the value of variable b. So if a contained 6 and b contained 2, the value of 62 would be assigned to the total variable. In this case 62 is 36, so the value 36 is assigned to the total variable. |