Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Metric_Converter
- {
- class Program
- {
- static void Main(string[] args)
- {
- double distance = double.Parse(Console.ReadLine());
- var metricInput = Console.ReadLine();
- var metricOutput = Console.ReadLine();
- var metrics = new Dictionary<string, double>()
- {
- {"m", 1},
- {"mm", 1000},
- {"cm", 100},
- {"mi", 0.000621371192},
- {"in", 39.3700787},
- {"km", 0.001},
- {"ft", 3.2808399},
- {"yd", 1.0936133},
- };
- var result = distance * (metrics[metricOutput] / metrics[metricInput]);
- Console.WriteLine($"{result:F8}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement