Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a currency converter that needs optimization.
- namespace Currency_converter
- {
- class Program
- {
- static void Main(string[] args)
- {
- double result = 0;
- var money = double.Parse(Console.ReadLine());
- var inputCurrency = Console.ReadLine();
- var outputCurrency =(Console.ReadLine());
- if (inputCurrency == "BGN")
- {
- if (outputCurrency == "EUR")
- {
- result = money / 1.95583;
- }
- else if (outputCurrency == "USD")
- {
- result = money / 1.79549;
- }
- else if (outputCurrency == "GBP")
- {
- result = money / 2.53405;
- }
- }
- else if (inputCurrency == "USD")
- {
- if (outputCurrency == "EUR")
- {
- result = (money * 1.79549) / 1.95583;
- }
- else if (outputCurrency == "BGN")
- {
- result = money * 1.79549;
- }
- else if (outputCurrency == "GBP")
- {
- result = (money * 1.79549) / 2.53405;
- }
- }
- else if (inputCurrency == "EUR")
- {
- if (outputCurrency == "USD")
- {
- result = (money * 1.95583) / 1.79549;
- }
- else if (outputCurrency == "BGN")
- {
- result = money * 1.95583;
- }
- else if (outputCurrency == "GBP")
- {
- result = (money * 1.95583) / 2.53405;
- }
- }
- else if (inputCurrency == "GBR")
- {
- if (outputCurrency == "USD")
- {
- result = (money * 2.53405) / 1.79549;
- }
- else if (outputCurrency == "BGN")
- {
- result = money * 2.53405;
- }
- else if (outputCurrency == "EUR")
- {
- result = (money * 2.53405) / 1.95583;
- }
- }
- Console.Write($"{result:F2} ");
- Console.WriteLine(outputCurrency);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement