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
+5.3k Golang : Print instead of building pyramids
+12.8k Android Studio : Highlight ImageButton when pressed on example
+9.5k Golang : Scramble and unscramble text message by randomly replacing words
+16.6k Golang : Get IP addresses of a domain name
+19k Golang : Read input from console line
+8k Javascript : Put image into Chrome browser's console
+18.2k Golang : Convert IPv4 address to decimal number(base 10) or integer
+13.4k Golang : Linear algebra and matrix calculation example
+20.5k Swift : Convert (cast) Int to int32 or Uint32
+8.1k Golang : What fmt.Println() can do and println() cannot do
+7k Golang : Calculate BMI and risk category
+5k Python : Convert(cast) bytes to string example