Remainder Operator in Go

Golang Remainder Operator takes two operands and returns the remainder when first operand is divided by second operand.

Golang Remainder Operator applies to integers only.

In this tutorial, we will learn about the syntax of Remainder Operator, and some example scenarios on how to use Remainder operator.


The syntax to get remainder of the division a/b, using Remainder Operator is


where a and b are operands and % is the operator symbol.

Return Value

The operator returns an integer value.



In the following example, we take two integer values in a and b, and find the remainder when a is divided by b.


package main

func main() {
	a := 8
	b := 3
	result := a % b
	println("Remainder of a/b = ", result)


Remainder of a/b =  2


In this Golang Tutorial, we learned about Division Operator in Go language, with the syntax and example programs.