Arithmetic and Operators
+ - * / % and bit operators. Integer division truncates. ++ and -- are statements.
Example
package main
import "fmt"
func main() {
a, b := 7, 2
fmt.Println(a/b, a%b, float64(a)/float64(b))
a++
fmt.Println(a, a&b, a<<1)
}Result
3 1 3.5 8 0 16
Exercise
Remainder.
7 2
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.