# Go – How to get imaginary part of the complex number in go

In this tutorial, We are going to learn about how to get imaginary part of the complex number in go. We can do it by using imag() built-in function in go.

imag() built-in function returns the imaginary part of the complex number

Function prototype:

```func imag(c ComplexType) FloatType

Input parameter:

c: Complex number```

Example:

```Input: 3 + 2i
output: 2

Input: 5 + 7i
output: 7```

Return type:

```imag() built-in function returns the
imaginary part of the complex number of
type float32.```

Example with code:

```package main

import (
"fmt"
)

func main() {

complex_num := 3 + 2i

y := imag(complex_num)

fmt.Println("imaginary num: ", y)

var num complex64

var x float32

num = 5 + 7i

x = imag(num)

fmt.Println("imaginary num: ", x)
}
```

Output:

```imaginary num: 2

imaginary num: 7```

`https://www.techieindoor.com/go-lang-tutorial/`
` https://golang.org/doc/ https://golang.org/pkg/ https://golang.org/pkg/fmt/ https://golang.org/pkg/fmt/#Println `