// Chapter 15 example: read a whole number with strconv.Atoi. // Run with: go run exercises/15/03-read-number.go package main import ( "bufio" "fmt" "os" "strconv" "strings" ) func main() { reader := bufio.NewReader(os.Stdin) fmt.Print("Enter a number: ") text, _ := reader.ReadString('\n') number, _ := strconv.Atoi(strings.TrimSpace(text)) fmt.Printf("Twice that is %d\n", number*2) }