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
+13.2k Golang : Skip blank/empty lines in CSV file and trim whitespaces example
+11.5k Golang : Delay or limit HTTP requests example
+10.5k Golang : cannot assign type int to value (type uint8) in range error
+9.8k Golang : Find correlation coefficient example
+22.4k Golang : Convert seconds to minutes and remainder seconds
+4.7k Javascript : Detect when console is activated and do something about it
+10.1k Golang : Setting variable value with ldflags
+19.6k Golang : Example for DSA(Digital Signature Algorithm) package functions
+7.3k Ubuntu : connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream
+19.7k Golang : Set or Add HTTP Request Headers
+9.2k Golang : Serving HTTP and Websocket from different ports in a program example
+5.1k Golang : Calculate a pip value and distance to target profit example