Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- class Program
- {
- static void Main()
- {
- double numberToConvert = double.Parse(Console.ReadLine());
- string firstUnit = Console.ReadLine();
- string secondUnit = Console.ReadLine();
- var units = new Dictionary<string, double>()
- {
- { "m", 1d },
- { "mm", 1000d },
- { "cm", 100d },
- { "mi", 0.000621371192d },
- { "in", 39.3700787d },
- { "km", 0.001d },
- { "ft", 3.2808399d },
- { "yd", 1.0936133d}
- };
- double result = numberToConvert / units[firstUnit] * units[secondUnit];
- Console.WriteLine(Math.Round(result, 8));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement