Advertisement
koksibg

Untitled

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