Here, we will learn how to get Pi value in go. We can use Pi constant of math package to get Pi value in go.
Constant value:
Pi = 3.14159265358979323846264338327950288419716939937510582097494459
Example with code:
package main
import (
"fmt"
"math"
)
func main() {
pi_val := math.Pi
fmt.Println("Pi value: ", pi_val)
}
Output:
$ go run sample.go
Pi value: 3.141592653589793
To learn more about golang, Please refer given below link:
https://techieindoor.com/go-lang-tutorial/
References:
https://golang.org/doc/
https://golang.org/pkg/