Go Arithmetic Operators


Arithmetic Operators

Arithmetic operators are used to perform common mathematical operations.

Operator Name Description Example Try it
+ Addition Adds together two values x + y Try it »
- Subtraction Subtracts one value from another x - y Try it »
* Multiplication Multiplies two values x * y Try it »
/ Division Divides one value by another x / y Try it »
% Modulus Returns the division remainder x % y Try it »
++ Increment Increases the value of a variable by 1 x++ Try it »
-- Decrement Decreases the value of a variable by 1 x-- Try it »

Go Exercises

Test Yourself With Exercises

Exercise:

Multiply 10 with 5, and print the result.

package main   
import ("fmt") 
func main() { fmt.Print(105) }

Start the Exercise


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.