Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Currency_Converter_12
- {
- class Program
- {
- static void Main(string[] args)
- {
- var currencyValue = double.Parse(Console.ReadLine());
- var currencyInName = Console.ReadLine();
- var currencyOutName = Console.ReadLine();
- byte indexIn = 0;
- byte indexOut = 0;
- string[] currencyName = {"BGN", "USD", "EUR", "GBP"};
- double[] currencyRate = { 1d, 1.79549d, 1.95583d, 2.53405 };
- for (byte i = 0; i < currencyName.Length; i++)
- {
- if (currencyInName == currencyName[i]) indexIn = i;
- if (currencyOutName == currencyName[i]) indexOut = i;
- }
- var currencyOut = currencyValue * currencyRate[indexIn] /
- currencyRate[indexOut];
- Console.WriteLine("Currency value result = {0}",
- Math.Round(currencyOut, 2));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement