Go language program to convert millimeters into centimeters

Views: 133   

Following program shows you how to convert millimeters into centimeters.
In this program we get millimeters from user, once we get those we need to divide with 10 so that we get in centimeters

package main

import "fmt"

func main() {

  var millimeters float64
  var centimeters float64
  fmt.Println("Please enter millimeters:")
  fmt.Scanf("%f", &millimeters)
  centimeters = millimeters / 10
  fmt.Println(centimeters , " Centimeters")
}

Output:

Please enter millimeters:
 52
5.2  Centimeters
On By