How to convert int to float in Go

1 Answer

0 votes
package main

import (
	"fmt"
)

func main() {
    var i int64 = 2349 

    var f float64 = float64(i) 

    fmt.Println(f) 
    fmt.Printf("%.2f", f) 
  
}




/*
run:

2349
2349.00

*/

 



answered May 26, 2020 by avibootz

Related questions

1 answer 240 views
240 views asked Oct 17, 2020 by avibootz
1 answer 175 views
2 answers 107 views
107 views asked Oct 30, 2024 by avibootz
1 answer 115 views
1 answer 198 views
3 answers 240 views
240 views asked May 26, 2020 by avibootz
...