Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var number float64
- fmt.Scanln(&number)
- var inputMetric, outputMetric string
- fmt.Scanln(&inputMetric)
- fmt.Scanln(&outputMetric)
- if inputMetric == "mm" {
- if outputMetric == "cm" {
- number /= 10
- } else {
- number /= 1000
- }
- } else if inputMetric == "cm" {
- if outputMetric == "m" {
- number /= 100
- } else {
- number *= 10
- }
- } else {
- if outputMetric == "cm" {
- number *= 100
- } else {
- number *= 1000
- }
- }
- fmt.Printf("%.3f", number)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement