Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CurrencyConverter
- {
- class CurrencyConverter
- {
- static void Main()
- {
- double OneUSDToBGN = 1.79549;
- double OneEURToBGN = 1.95583;
- double OneGBPToBGN = 2.53405;
- double OneBGNToEUR = 1 / OneEURToBGN;
- double OneBGNToUSD = 1 / OneUSDToBGN;
- double OneBGNToGBP = 1 / OneGBPToBGN;
- double OneUSDToEUR = OneUSDToBGN / OneEURToBGN;
- double OneUSDToGBP = OneUSDToBGN / OneGBPToBGN;
- double OneEURToUSD = OneEURToBGN / OneUSDToBGN;
- double OneEURToGBP = OneEURToBGN / OneGBPToBGN;
- double OneGBPToUSD = OneGBPToBGN / OneUSDToBGN;
- double OneGBPToEUR = OneGBPToBGN / OneEURToBGN;
- Console.Write("Amount to convert = ");
- double Amount = double.Parse(Console.ReadLine());
- Console.WriteLine("Select Imput Currency: BGN, USD, EUR or GBP");
- string ImputCurrency = Console.ReadLine();
- Console.WriteLine("Select Output Currency: BGN, USD, EUR or GBP");
- string OutputCurrency = Console.ReadLine();
- double BGNConvertToBGN = Amount;
- double BGNConvertToUSD = Amount * OneBGNToUSD;
- double BGNConvertToEUR = Amount * OneBGNToEUR;
- double BGNConvertToGBP = Amount * OneBGNToGBP;
- double USDConvertToUSD = Amount;
- double USDConvertToEUR = Amount * OneUSDToEUR;
- double USDConvertToGBP = Amount * OneUSDToGBP;
- double USDConvertToBGN = Amount * OneUSDToBGN;
- double EURConvertToEUR = Amount;
- double EURConvertToBGN = Amount * OneEURToBGN;
- double EURConvertToUSD = Amount * OneEURToUSD;
- double EURConvertToGBP = Amount * OneEURToGBP;
- double GBPConvertToGBP = Amount;
- double GBPConvertToBGN = Amount * OneGBPToBGN;
- double GBPConvertToUSD = Amount * OneGBPToUSD;
- double GBPConvertToEUR = Amount * OneGBPToEUR;
- while ((ImputCurrency == "BGN") && (OutputCurrency == "USD"))
- {
- Console.WriteLine("converted currency = " + Math.Round(BGNConvertToUSD, 2));
- return;
- }
- while ((ImputCurrency == "BGN") && (OutputCurrency == "EUR"))
- {
- Console.WriteLine("converted currency = " + Math.Round(BGNConvertToEUR, 2));
- return;
- }
- while ((ImputCurrency == "BGN") && (OutputCurrency == "GBP"))
- {
- Console.WriteLine("converted currency = " + Math.Round(BGNConvertToGBP, 2));
- return;
- }
- while ((ImputCurrency == "USD") && (OutputCurrency == "BGN"))
- {
- Console.WriteLine("converted currency = " + Math.Round(USDConvertToBGN, 2));
- return;
- }
- while ((ImputCurrency == "USD") && (OutputCurrency == "EUR"))
- {
- Console.WriteLine("converted currency = " + Math.Round(USDConvertToEUR, 2));
- return;
- }
- while ((ImputCurrency == "USD") && (OutputCurrency == "GBP"))
- {
- Console.WriteLine("converted currency = " + Math.Round(USDConvertToGBP, 2));
- return;
- }
- while ((ImputCurrency == "EUR") && (OutputCurrency == "BGN"))
- {
- Console.WriteLine("converted currency = " + Math.Round(EURConvertToBGN, 2));
- return;
- }
- while ((ImputCurrency == "EUR") && (OutputCurrency == "USD"))
- {
- Console.WriteLine("converted currency = " + Math.Round(EURConvertToUSD, 2));
- return;
- }
- while ((ImputCurrency == "EUR") && (OutputCurrency == "GBP"))
- {
- Console.WriteLine("converted currency = " + Math.Round(EURConvertToGBP, 2));
- return;
- }
- while ((ImputCurrency == "GBP") && (OutputCurrency == "BGN"))
- {
- Console.WriteLine("converted currency = " + Math.Round(GBPConvertToBGN, 2));
- return;
- }
- while ((ImputCurrency == "GBP") && (OutputCurrency == "EUR"))
- {
- Console.WriteLine("converted currency = " + Math.Round(GBPConvertToEUR, 2));
- return;
- }
- while ((ImputCurrency == "GBP") && (OutputCurrency == "USD"))
- {
- Console.WriteLine("converted currency = " + Math.Round(GBPConvertToUSD, 2));
- return;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement