Go program to find quotient and remainder of integers. In this program, The remainder is the integer left over after dividing one integer by another. The quotient is the quantity produced by the division of two numbers. In the below expression, 7 is divided by 2, so the quotient is 3 and the remainder is 1.
Go Program To Find Quotient and Remainder of a integers
Source Code
package main
import (
"fmt"
)
func main() {
numerator := 50
denominator := 30
/*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)
}
Output