Answers for "how to convert int to float go lang"

Go
1

convert float to int golang

package main
import "fmt"
func main() {
  var x float64 = 5.7
  var y int = int(x)
  fmt.Println(y)  // outputs "5"
}
Posted by: Guest on August-11-2021

Browse Popular Code Answers by Language