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
+32.6k Golang : Proper way to set function argument default value
+18.9k Nginx + FastCGI + Go Setup.
+17.3k Golang : Write file with io.WriteString
+17.3k Golang : Example for RSA package functions
+5.8k Default cipher that OpenSSL used to encrypt a PEM file
+6.3k Golang : Word limiter example
+8.8k Golang : Check if user agent is a robot or crawler example
+28.4k Golang : How to verify uploaded file is image or allowed file types
+6.3k Golang : File system scanning
+27.2k Golang : Detect (OS) Operating System
+25.2k Golang : Find files by extension