Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class CurrencyConverter
- {
- static void Main()
- {
- var amount = double.Parse(Console.ReadLine());
- string firstCurrency = Console.ReadLine();
- string secondCurrency = Console.ReadLine();
- double value1 = CheckCurrency(firstCurrency);
- double value2 = CheckCurrency(secondCurrency);
- double result = (value1 / value2) * amount;
- Console.WriteLine("{0} {1}",Math.Round(result, 2),secondCurrency);
- }
- static double CheckCurrency(string curr)
- {
- switch (curr)
- {
- case "BGN":
- return 1;
- case "USD":
- return 1.79549;
- case "EUR":
- return 1.95583;
- case "GBP":
- return 2.53405;
- default:
- return 1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement