Formatting Floats

Hi,

The following code outputs a number in scientifc form. I’d like to format to display the number in the millions. Any help out there? Thanks.

package main

import (
“fmt”
)

func main() {

var a=7500.2
var b=1123.23

var c=a*b

fmt.Println©
}

Use fmt.Printf and a %f format specifier. playground

%f	decimal point but no exponent, e.g. 123.456

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.