Title: Arithmetic Operators
Course: CPS 120: Introduction to Computer Science ~ Master (Aug/2015) OLD > Section: Learning Units

Perform arithmetic on two numeric expressions which may include:

- Two integer expressions
- Two real number expressions
- One integer and one real number expression

Operation | Operator
Addition | +
Subtraction | -
Multiplication | *
Divide | /
Divide and truncate | //
Remainder after division | %
Exponentiation | **

Arithmetic Operator Examples

Numeric expression | Result
2 + 5 | 7
2 – 5 | -3
2 * 5 | 10
2 / 5 | 0.4
2 // 5 (calculate 2/5,then discard fractional part) | 0
2 % 5 (calculate 2/5, then take remainder) | 2
2 ** 5 | 32