# Golang : Math pow(the power of x^y) example

No programming language will be complete without `the power of`

math function. This tutorial is a simple example on how to use `math.Pow()`

function.

In Math

2^5 = 2x2x2x2x2 =32In Golang

Math.pow(2, 5)

In code :

```
package main
import (
"fmt"
"math"
)
func main() {
result := math.Pow(2, 5)
fmt.Println(" 2 power of 5 is : ", result)
x := 10.5
y := 5
floatResult := math.Pow(x, float64(y)) //type cast int to float64
fmt.Printf(" %.02f power of %d is : %.02f \n", x, y, floatResult)
}
```

2 power of 5 is : 32

10.50 power of 5 is : 127628.16

##### By Adam Ng

IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.

#### Advertisement

#### Tutorials

+1.6k Golang : Calculate US Dollar Index (DXY)

+2.5k Golang : Configure crontab to poll every two minutes 8am to 6pm Monday to Friday

+4.9k Golang : How to pipe input data to executing child process?

+2.8k Golang : Create zip/ePub file without compression(use Store algorithm)

+2.6k Golang : Return multiple values from function

+6.3k Golang : Read file and convert content to string

+6.8k Golang : Get download file size

+2.3k Golang : Send data to /dev/null a.k.a blackhole with ioutil.Discard

+15.4k Golang : Setting up/configure AWS credentials with official aws-sdk-go

+5.7k Golang : Accurate and reliable decimal calculations

+3.2k Android Studio : Indicate progression with ProgressBar example