+ | (Addition) Adds 2 numbers. |
++ | (Increment) Adds one to a variable representing a number (returning either the new or old value of the variable). The increment operator is used as follows: var++ or ++var The increment operator increments (adds one to) its operand and returns a value. If it is used postfix, with operator after operand (for example, x++), then it returns the value before incrementing. If it is used prefix with operator before operand (for example, ++x), then it returns the value after incrementing. For example, if x is three, then the statement y = x++ sets y to 3 and increments x to 4. If x is 3, then the statement y = ++x increments x to 4 and sets y to 4. |
-- | (Decrement) Subtracts one from a variable representing a number (returning either the new or old value of the variable). The decrement operator is used as follows: var-- or --var The decrement operator decrements (subtracts one from) its operand and returns a value. If it is used postfix (for example, x--), then it returns the value before decrementing. If it is used prefix (for example, --x), then it returns the value after decrementing. For example, if x is three, then the statement y = x-- sets y to 3 and decrements x to 2. If x is 3, then the statement y = --x decrements x to 2 and sets y to 2. |
- | (Unary negation, subtraction) As a unary operator, negates the value of its argument. As a binary operator, subtracts two numbers. The unary negation operator precedes its operand and negates it. For example, y = -x negates the value of x and assigns that to y; that is, if x were 3, y would get the value -3 and x would retain the value 3. |
* | (Multiplication) Multiplies two numbers. |
/ | (Division) Divides two numbers. |
% | (Modulus) Computes the integer remainder of dividing two numbers. The modulus operator is used as follows: var1 % var2 The modulus operator returns the first operand modulo the second operand, that is, var1 modulo var2, in the preceding statement, where var1 and var2 are variables. The modulo function is the integer remainder of dividing var1 by var2. For example, 12 % 5 returns 2. |