Go Arithmetic Operators
Addition
To add two numbers, put the plus symbol (+
) between them.
Subtraction
To subtract two numbers, put the dash symbol (-
) between them.
Multiplication
To multiply two numbers, put an asterisk (*
) between them.
Division
To divide two numbers, put a slash (/
) between them.
Getting the Remainder
To get the remainder when we divide two numbers, put a percent sign (%
) between them. In programming lingo, this is called the modulus operator.
Increment
To add one to a number, put two plus signs (++
) after it. For example, n++
.
Decrement
To subtract one from a number, put two dashes (--
) after it. For example, n--
.