Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var distance float64
- fmt.Scanln(&distance)
- var inputMetric, outputMetric string
- fmt.Scanln(&inputMetric)
- fmt.Scanln(&outputMetric)
- if inputMetric == "m" {
- distance /= 1000
- } else if inputMetric == "cm" {
- distance /= 100000
- } else if inputMetric == "mm" {
- distance /= 1000000
- } else if inputMetric == "mi" {
- distance /= 0.621371192
- } else if inputMetric == "in" {
- distance /= 39370.0787
- } else if inputMetric == "ft" {
- distance /= 3280.8399
- } else if inputMetric == "yd" {
- distance /= 1093.6133
- }
- if outputMetric == "m" {
- distance *= 1000
- } else if outputMetric == "cm" {
- distance *= 100000
- } else if outputMetric == "mm" {
- distance *= 1000000
- } else if outputMetric == "mi" {
- distance *= 0.621371192
- } else if outputMetric == "in" {
- distance *= 39370.0787
- } else if outputMetric == "ft" {
- distance *= 3280.8399
- } else if outputMetric == "yd" {
- distance *= 1093.6133
- }
- fmt.Printf("%f", distance)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement