Go language program to convert centimeters into millimeters

Views: 102   

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

package main

import "fmt"

func main() {

  var centimeters int
  var millimeters int
  fmt.Println("Please enter centimeters:")
  fmt.Scanf("%d", &centimeters)
  millimeters = centimeters * 10
  fmt.Println(millimeters , " Millimeters")
}

Output:

Please enter centimeters:
 22
220  Millimeters
On By