- Arithmetic operators perform arithmetic on numbers (literals or variables).
- A typical arithmetic operation operates on two numbers.
- The two numbers can be literals.
Operators and Operands
- The numbers (in an arithmetic operation) are called operands.
- The operation (to be performed between the two operands) is defined by an operator.
- The addition operator (+) adds numbers:
- The subtraction operator (-) subtracts numbers.
- The multiplication operator (*) multiplies numbers.
- The division operator (/) divides numbers.
- The modulus operator (%) returns the division remainder.
- The increment operator (++) increments numbers.
- The decrement operator (--) decrements numbers.
- The exponentiation operator (**) raises the first operand to the power of the second operand.
- Operator precedence describes the order in which operations are performed in an arithmetic expression.