Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace _1000DaysAfterBirth
- {
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- public class Program
- {
- public static void Main()
- {
- double amountToConvert = double.Parse(Console.ReadLine());
- string fromCurrency = Console.ReadLine();
- string toCurrency = Console.ReadLine();
- string bgnString = "BGN";
- string usdString = "USD";
- string eurString = "EUR";
- string gbpString = "GBP";
- double bgnValue = 1.0;
- double usdValue = 1.79549;
- double eurValue = 1.95583;
- double gbpValue = 2.53405;
- double fromValue = 0.0;
- double toValue = 0.0;
- if (fromCurrency == bgnString)
- {
- fromValue = bgnValue;
- if (toCurrency == usdString)
- {
- toValue = usdValue;
- }
- else if (toCurrency == eurString)
- {
- toValue = eurValue;
- }
- else if (toCurrency == gbpString)
- {
- toValue = gbpValue;
- }
- }
- else if (fromCurrency == usdString)
- {
- fromValue = usdValue;
- if (toCurrency == bgnString)
- {
- toValue = bgnValue;
- }
- else if (toCurrency == eurString)
- {
- toValue = eurValue;
- }
- else if (toCurrency == gbpString)
- {
- toValue = gbpValue;
- }
- }
- else if (fromCurrency == eurString)
- {
- fromValue = eurValue;
- if (toCurrency == bgnString)
- {
- toValue = bgnValue;
- }
- else if (toCurrency == usdString)
- {
- toValue = usdValue;
- }
- else if (toCurrency == gbpString)
- {
- toValue = gbpValue;
- }
- }
- else if (fromCurrency == gbpString)
- {
- fromValue = gbpValue;
- if (toCurrency == bgnString)
- {
- toValue = bgnValue;
- }
- else if (toCurrency == usdString)
- {
- toValue = usdValue;
- }
- else if (toCurrency == eurString)
- {
- toValue = eurValue;
- }
- }
- double result = (fromValue / toValue) * amountToConvert;
- Console.WriteLine($"{result:f2} {toCurrency}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement