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
+5.2k Golang : Check if a word is countable or not
+5.4k JavaScript/JQuery : Redirect page examples
+14.8k Golang : How to check if your program is running in a terminal
+9.7k Golang : Accessing content anonymously with Tor
+11.1k Golang : Replace a parameter's value inside a configuration file example
+23.3k Golang : Print out struct values in string format
+14.1k Golang : concatenate(combine) strings
+14.2k Golang : Google Drive API upload and rename example
+27.7k Golang : Convert integer to binary, octal, hexadecimal and back to integer
+52.9k Golang : How to get struct field and value by name
+7.1k Golang : Levenshtein distance example
+6k Golang : Detect variable or constant type