Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class CurrencyConverter
- {
- static void Main(string[] args)
- {
- decimal BGN = 1.0M;
- decimal USD = 1.79549M;
- decimal EUR = 1.95583M;
- decimal GBP = 2.53405M;
- decimal inputValue = decimal.Parse(Console.ReadLine());
- string inputCurrency = Console.ReadLine();
- string outputCurrency = Console.ReadLine();
- switch(inputCurrency)
- {
- case "BGN":
- break;
- case "USD":
- inputValue = inputValue * USD;
- break;
- case "EUR":
- inputValue = inputValue * EUR;
- break;
- case "GBP":
- inputValue = inputValue * GBP;
- break;
- }
- switch(outputCurrency)
- {
- case "BGN":
- inputValue = inputValue / BGN;
- break;
- case "USD":
- inputValue = inputValue / USD;
- break;
- case "EUR":
- inputValue = inputValue / EUR;
- break;
- case "GBP":
- inputValue = inputValue / GBP;
- break;
- }
- Console.WriteLine("{0:F2} {1}" , inputValue , outputCurrency);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement