AJMitev

MoneyConvertor

Dec 30th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace MoneyConvertor
  5. {
  6.     class MoneyConvertor
  7.     {
  8.         static void Main()
  9.         {
  10.             decimal moneyValue = decimal.Parse(Console.ReadLine());
  11.             string firstCurrency = Console.ReadLine().ToUpper();
  12.             string secondCurrency = Console.ReadLine().ToUpper();
  13.             var currencies = new Dictionary<string, decimal>
  14.             {
  15.                 {"BGN", 1.00m },
  16.                 { "EUR", 1.95583m},
  17.                 { "USD", 1.79549m},
  18.                 { "GBP", 2.53405m}
  19.             };
  20.             decimal calculation = moneyValue * (currencies[firstCurrency] / currencies[secondCurrency]);
  21.             Console.WriteLine(Math.Round(calculation,2) + " {0}", secondCurrency);
  22.  
  23.  
  24.         }
  25.  
  26.     }
  27. }
Add Comment
Please, Sign In to add comment