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
+20.5k Golang : Join arrays or slices example
+25.1k Golang : Encrypt and decrypt data with AES crypto
+10.3k Golang : Generate DSA private, public key and PEM files example
+9.1k Golang : Text file editor (accept input from screen and save to file)
+14.3k Golang : How to convert(cast) IP address to string?
+18.6k Golang : Set or Add HTTP Request Headers
+5.7k Restart Apache or Nginx web server without password prompt
+20.8k Fix "Failed to start php5-fpm.service: Unit php5-fpm.service is masked."
+12.4k Golang : Query string with space symbol %20 in between
+10.9k Golang : Flush and close file created by os.Create and bufio.NewWriter example
+21.5k Golang : Get ASCII code from a key press(cross-platform) example
+14.1k Golang : How to login and logout with JWT example