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
+9.7k Golang : How to extract video or image files from html source code
+9.6k Golang : Qt Yes No and Quit message box example
+7k Mac/Linux/Windows : Get CPU information from command line
+16.6k Golang : Check if a string contains multiple sub-strings in []string?
+23.1k Golang : Calculate time different
+13.6k Golang : How to get year, month and day?
+11.9k Golang : convert(cast) float to string
+5.3k Linux/Unix/MacOSX : Find out which application is listening to port 80 or use which IP version
+5.6k Golang : If else example and common mistake
+7.2k Golang : Validate credit card example
+26.1k Golang : How to read integer value from standard input ?