# 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

+11.1k Golang : Get input from keyboard

+2.6k Golang : Configure Apache and NGINX to access your Go service example

+2.8k Golang : Fix opencv.LoadHaarClassifierCascade The node does not represent a user object error

+4.9k Golang : How to feed or take banana with Gorilla Web Toolkit Session package

+17.8k Golang : Get and Set User-Agent examples

+5k PHP : Get coordinates latitude/longitude from string

+3.9k Golang : Scan files for certain pattern and rename part of the files

+2.9k Golang : Humanize and Titleize functions

+13.8k Golang : How to count the number of repeated characters in a string?

+7.6k Golang : Rename directory

+3.6k Elasticsearch : Shutdown a local node

+2.1k Linux/Unix/MacOSX : Find out which application is listening to port 80 or use which IP version