Advertisement
koksibg

Untitled

Jun 25th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace MetricConverter
  5. {
  6. class MetricConverter
  7. {
  8. static void Main(string[] args)
  9. {
  10. double number = double.Parse(Console.ReadLine());
  11. string input = Console.ReadLine().ToLower();
  12. string output = Console.ReadLine().ToLower();
  13. var ConvertedUnit = new Dictionary<string, double>()
  14. {
  15. {"mm", 1000 },
  16. {"cm", 100},
  17. {"m", 1},
  18. {"km", 0.001},
  19. {"mi", 0.000621371192},
  20. {"in", 39.3700787},
  21. {"ft", 3.2808399},
  22. {"yd", 1.0936133}
  23. };
  24. double result = number / ConvertedUnit[input] * ConvertedUnit[output];
  25. Console.WriteLine("{0} {1}", result, output);
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement