sample input output golang code example
Example: user input golang
import (
"fmt"
"bufio"
)
//reading an integer
var age int
fmt.Println("What is your age?") // Question to the user
_, err: fmt.Scan(&age)
//reading a string
reader := bufio.newReader(os.Stdin)
var name string
fmt.Println("What is your name?") // Question to the user
name, _ := reader.readString('\n')
fmt.Println("Your name is ", name, " and you are age ", age)
}