Arithmetic Operators
These are basic mathematical operators that can be used on integers and floats.
Name | Maths | Operator | Example | Note |
---|---|---|---|---|
Addition | + |
x + y |
||
Subtraction | - |
x - y |
||
Multiplication | * |
x * y |
||
Division | / |
x / y |
Division by zero will throw an exception. | |
Modulus | % |
x % y |
Returns remainder of division. | |
Exponentiation | ** |
x ** y |
In C# , use Math.Pow(x, y) for exponentiation as ** is not a valid operator. |
^arithmatic-ops