Advertisement
Sim0o0na

Untitled

Jan 14th, 2017
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 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. namespace METRIC_CONVERTER
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             double numbersToConvert = double.Parse(Console.ReadLine());
  13.             string firstNumber = Console.ReadLine();
  14.             string secondNumber = Console.ReadLine();
  15.             var currencies = new Dictionary<string, double>()
  16.             {
  17.                 {"mm", 1000 },
  18.                 {"cm", 100 },
  19.                 {"mi", 0.000621371192},
  20.                 {"in", 39.3700787},
  21.                 {"km", 0.001},
  22.                 {"ft", 3.2808399},
  23.                 {"yd", 1.0936133},
  24.                 {"m", 1},
  25.             };
  26.             double result = numbersToConvert / currencies[firstNumber] * currencies[secondNumber];
  27.        
  28.             Console.WriteLine("{0} {1}",result,secondNumber);
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement