logo image

Go language program to convert miles to kilometers


Following program shows you how to convert miles to kilometers. In this program we get miles from user, once we get those we need to multiply with 1.6 so that we get in kilometers

package main

import "fmt"

func main() {

  var miles float64
  var kilometers float64
  fmt.Println("Please enter miles:")
  fmt.Scanf("%f", &miles)
  kilometers = miles * 1.6
  fmt.Println(kilometers , " Kilometers")


Please enter miles:
128  Kilometers