Convert miles to kilometer in Go

Programs take the user input in miles and display the result in kilo meter. Handled the user input error handling _, err := fmt.Scanf("%v", &miles).

package main

import "fmt"

const milesToKilometers = 1.60934

func main() {
    var miles float64
    fmt.Print("Enter miles:")
    _, err := fmt.Scanf("%v", &miles)
    if err != 0 {
        fmt.Println(err)
    }
    kilometers := miles * milesToKilometers
    fmt.Println("kilometers :", kilometers)
}



Output :
miles:10
kilometers : 16.0934