Arithmetic operators take numerical values (either literals
or variables) as their operands and return a single numerical value.
The standard arithmetic operators are:
+
Addition
-
Subtraction
*
Multiplication
/
Division
%
Modulus: the remainder after division;
e.g. 10 % 3 yields 1.
++
Unary increment: this operator only takes one operand.
The operand's value is increased by 1. The value returned depends
on whether the ++ operator is placed before or after the operand;
e.g. ++x will return the value of x following the
increment whereas x++ will return the value of x prior
to the increment.
--
Unary decrement: this operator only takes one operand.
The operand's value is decreased by 1. The value returned depends
on whether the -- operator is placed before or after the operand;
e.g. --x will return the value of x following the
decrement whereas x-- will return the value of x prior
to the decrement.