[Go] Round a number up to the nearest integer

Created on November 30, 2026

Use math.Ceil to round a floating-point number toward positive infinity. In this example, 1.1 becomes 2.

package main

import (
    "fmt"
    "math"
)

func main() {
    i := 1.1
    fmt.Println(math.Ceil(i))
}

Output

2
Go