/
Arithmetic Operators

Arithmetic Operators

Operation

Description

Example

Operation

Description

Example

+

Addition

myvar2 = myvar + 1

Subtraction

myvar2 = myvar -- 1

Negation

myvar2 = -myvar

*

Multiplication

myvar2 = myvar * 10

/

Division

myvar2 = myvar / 10

%

Modulo (remainder from division)

myvar2 = 47 % 10(this assigns 7 to myvar2)

^

Exponentiation

myvar2 = 2^5(this is 2 to the power 5, or 32)

 

Related content

Operators
More like this
Operator Overloading
Operator Overloading
More like this
How can we find the remainder?
How can we find the remainder?
More like this
How do computers represent negative numbers?
How do computers represent negative numbers?
More like this
How does binary work?
How does binary work?
More like this
How do we add and increment Javascript numbers?
How do we add and increment Javascript numbers?
More like this