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
+11.8k Golang : Verify Linux user password again before executing a program example
+9.9k Golang : Translate language with language package example
+11.5k Golang : Change date format to yyyy-mm-dd
+27.6k Golang : dial tcp: too many colons in address
+19k Golang : Padding data for encryption and un-padding data for decryption
+23.9k Golang : Use regular expression to validate domain name
+10k Golang : Channels and buffered channels examples
+19.8k Golang : Archive directory with tar and gzip
+13.8k Golang : unknown escape sequence error
+6.9k Golang : Calculate BMI and risk category
+17.2k Golang : When to use init() function?
+16.4k Golang : Test floating point numbers not-a-number and infinite example