Complex problem

Report a typo

Your friend Leonhard Euler is currently working on an important theorem about complex numbers. He needs a program that can convert the entered number to the complex type to check the calculations.
He chose Go because he had heard that the language made it easy to work with complex numbers. Help him finish recognizing a number from the entered string.

You'll need to take a look at the Parse family of functions in the documentation of the strconv package to learn what function converts a string to the complex128 type.

Sample Input 1:

8+11i

Sample Output 1:

value: (8+11i), type: complex128
Write a program in Go
package main

import (
"fmt"
"strconv"
)

const bitSize = 128

func main() {
var data string
fmt.Scanln(&data)

num, err := ?.?(?, bitSize)
if err != nil {
fmt.Println(err)
}
fmt.Printf("value: %v, type: %[1]T", num)
}
___

Create a free account to access the full topic