Golang : micron to centimeter example
Problem:
You need to convert centimeter to micron (µ) in Golang. How to do that?
Solution:
Simple. See the following code:
package main
import (
"fmt"
)
func micron2cm(µ float64) float64 {
return µ / 10000
}
func cm2micron(cm float64) float64 {
return cm * 10000
}
func main() {
fmt.Println("10 µ in centimeter is : ", micron2cm(10.0))
fmt.Println(micron2cm(10.0), " centimeter in µ :", cm2micron(micron2cm(10.0)))
}
Output:
10 µ in centimeter is : 0.001
0.001 centimeter in µ : 10
References:
http://www.allmeasures.com/Fullconversion.asp
https://socketloop.com/tutorials/golang-temperatures-conversion-example
See also : Golang : Temperatures conversion example
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+23.4k Golang : minus time with Time.Add() or Time.AddDate() functions to calculate past date
+5.3k How to check with curl if my website or the asset is gzipped ?
+26.2k Golang : Get executable name behind process ID example
+6.4k Golang : Map within a map example
+18.1k Golang : Get command line arguments
+16.9k Golang : XML to JSON example
+7.2k Golang : File system scanning
+9.1k Android Studio : Indicate progression with ProgressBar example
+10.8k Golang : Replace a parameter's value inside a configuration file example
+10.1k Golang : Text file editor (accept input from screen and save to file)
+5.1k Golang : The Tao of importing package