# Go – Program to convert binary number to decimal in go

Here, we will see program to convert binary number to decimal in go. Given below, you can find algorithm and program.

To convert binary number to decimal number, we will use ParseInt() function of strconv package.

```Input:Â binary num = 1010
Decimal number = 10

Input:Â binary num = 111
Decimal number = 7

Input:Â binary num = 1111
Decimal number = 15```

Code:

```package main

import (

"fmt"
"strconv"
)

func main() {

bin_num := "1010"

num, err := strconv.ParseInt(bin_num, 2, 64)

if err != nil {

panic(err)

}

fmt.Println("decimal num: ", num)

bin_num = "111"

num, err = strconv.ParseInt(bin_num, 2, 64)

if err != nil {

panic(err)

}

fmt.Println("decimal num: ", num)

bin_num = "1111"

num, err = strconv.ParseInt(bin_num, 2, 64)

if err != nil {

panic(err)

}

fmt.Println("decimal num: ", num)

}
```

Output:

```decimal num: 10

decimal num: 7

decimal num: 15```

`https://www.techieindoor.com/go-lang/`
```https://golang.org/doc/