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
+50.9k Golang : Disable security check for HTTPS(SSL) with bad or expired certificate
+32.6k Golang : Regular Expression for alphanumeric and underscore
+7.6k Golang : Mapping Iban to Dunging alphabets
+29.8k Golang : How to get HTTP request header information?
+5.3k Python : Delay with time.sleep() function example
+7.5k Golang : How to handle file size larger than available memory panic issue
+7.2k Golang : How to iterate a slice without using for loop?
+5.7k Fix yum-complete-transaction error
+5.7k Unix/Linux/MacOSx : Get local IP address
+8.2k Golang : HttpRouter multiplexer routing example
+36.2k Golang : How to split or chunking a file to smaller pieces?
+10.5k Golang : Bubble sort example