A type of operator which uses numbers to perform simple mathematic equations. It is made up of two operands .
For example, if you were to say x + y
the letters x
and y
are your operands. When you then ask the computer to show you the value of this expression you would get sum of those two values.
Although they vary in how they are written between languages, the arithmetic operators are roughly as follows:
Operator | Example | Description |
---|---|---|
+ | 2 + 3 returns 5 | the right value added to the left value |
– | 2 – 3 returns -1 | the right value subtracted from the left value |
* | 2 * 3 returns 6 | the right value multiplied by the left value |
/ | 2 / 3 returns 0.6666666666 | the right value divided by the left value |
% | 2 % 3 returns 2 | the remainder of the right value divided by the left value |
** | 2 ** 3 returns 8 | the left value to the power of the right value |