How to print numbers with only 2 digits after the decimal point in Go

1 Answer

0 votes
package main

import "fmt"

func main() {
	number := 15.2570188

	fmt.Printf("%.2f\n", number)
}



/*
run:

15.26

*/

 



answered Sep 17, 2024 by avibootz
...