[Go] Round to the nearest integer with math.Round

Created on November 30, 2026

math.Round rounds a floating-point value to the nearest integer value and returns it as a float64. Halfway values round away from zero.

package main

import (
    "fmt"
    "math"
)

func main() {
    i := 111.5
    fmt.Println(math.Round(i))
}
112
Go