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
+26.3k Golang : JQuery AJAX post data to server and send data back to client example
+5.5k Golang : Scanf function weird error in Windows
+10.3k Golang : Extract part of string with regular expression
+6.4k Golang : Ackermann function example
+10.3k Golang : "https://" not allowed in import path
+11.1k Golang : Convert IP version 6 address to integer or decimal number
+7.4k Golang : Eroding and dilating image with OpenCV example
+9.3k Golang : Verify Linux user password again before executing a program example
+6.8k Golang : Get curl -I or head data from URL example
+20.9k Golang : Strings to lowercase and uppercase example
+9.7k Golang : Arithmetic operation with numerical slices or arrays example
+8.8k Swift : Convert (cast) String to Integer