Menu Close

Go – How to get Pi value in go

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 (

func main() {

  pi_val := math.Pi

  fmt.Println("Pi value: ", pi_val)



$ go run sample.go
Pi value:  3.141592653589793

To learn more about golang, Please refer given below link:

Posted in golang, math

Leave a Reply

Your email address will not be published. Required fields are marked *