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
+3.1k Swift : Get substring with rangeOfString() function example
+4.3k Golang : Identifying Golang HTTP client request
+6.4k Golang : How to unmarshal JSON inner/nested value and assign to specific struct?
+9.5k Golang : Compare floating-point numbers
+2.4k Fontello : How to load and use fonts?
+10k Golang : Use TLS version 1.2 and enforce server security configuration over client
+5.7k Golang : Accurate and reliable decimal calculations
+5.3k Golang : Sort and reverse sort a slice of integers
+3.6k Golang : Load DSA public key from file example
+9.7k Golang : Capture stdout of a child process and act according to the result
+4.5k Golang : Arithmetic operation with numerical slices or arrays example
+2.7k Unix/Linux : How to test user agents blocked successfully ?