# Golang Example to find quotient and remainder of a integers In this example program, We will find `quotient` and `remainder` from the given `numerator`(dividend) and `denominator` (divisor) using `modulus` and `division` operators in Golang.

Usually, The `quotient` is a result of the `division operator` in mathematics.

In golang, `division` operator `/` is used and applied to integers.

the `remainder` is a result of the `modulus operator` in mathematics. `%` symbol is defined in Golang.

## Find Quotient and Remainder for a given number in the golang program?

The below example explains about golang arithmetic operators

• `Division operator`: Divide the numerator with the denominator.
• `Modulus operator`: Output remainder for the result of the division operator.

Following is an example of Division and modulus operator in Golang

``````package main

import (
"fmt"
)

func main() {
numerator := 40
denominator := 20
/*quotient := numerator / denominator
remainder := numerator % denominator */

//above-commented code can be replaced with single line as below
quotient, remainder := numerator/denominator, numerator%denominator

fmt.Println("quotient result:", quotient)
fmt.Print("remainder result:", remainder)

}``````

The output of the above program is

``````quotient result: 2
remainder result:0``````

In the above example,

• Two integer numbers 40(numerator) and 20(denominator) are stored in a variable - numerator, and denominator.
• 40 is divided by 20 using / Operator. and the result is stored in the quotient variable.
• the remainder of 40/20 is 0, stored in a remainder variable.

Both quotient and remainder variables values are printed to console using `fmt println function`.

## Conclusion

Learn How to get quotient and remainder for a given integer with example in golang.