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 CurrencyConverter
- {
- class Program
- {
- static void Main(string[] args)
- {
- double amountToConvert = double.Parse(Console.ReadLine());
- string incomingCurrency = Console.ReadLine();
- string sourceCurrency = Console.ReadLine();
- double USD = 1.79549;
- double EUR = 1.95583;
- double GBP = 2.53405;
- double currentCurrency = 0;
- double totalSum = 0;
- if (incomingCurrency == "BGN")
- {
- currentCurrency = amountToConvert;
- if (sourceCurrency == "USD")
- {
- totalSum = currentCurrency / USD;
- }
- else if (sourceCurrency == "EUR")
- {
- totalSum = currentCurrency / EUR;
- }
- else if (sourceCurrency == "GBP")
- {
- totalSum = currentCurrency / GBP;
- }
- }
- else if (incomingCurrency == "USD")
- {
- currentCurrency = amountToConvert * USD;
- if (sourceCurrency == "BGN")
- {
- totalSum = currentCurrency;
- }
- else if (sourceCurrency == "EUR")
- {
- totalSum = currentCurrency / EUR;
- }
- else if (sourceCurrency == "GBP")
- {
- totalSum = currentCurrency / GBP;
- }
- }
- else if (incomingCurrency == "EUR")
- {
- currentCurrency = amountToConvert * EUR;
- if (sourceCurrency == "BGN")
- {
- totalSum = currentCurrency;
- }
- else if (sourceCurrency == "USD")
- {
- totalSum = currentCurrency / USD;
- }
- else if (sourceCurrency == "GBP")
- {
- totalSum = currentCurrency / GBP;
- }
- }
- else if (incomingCurrency == "GBP")
- {
- currentCurrency = amountToConvert * GBP;
- if (sourceCurrency == "BGN")
- {
- totalSum = currentCurrency;
- }
- else if (sourceCurrency == "USD")
- {
- totalSum = currentCurrency / USD;
- }
- else if (sourceCurrency == "EUR")
- {
- totalSum = currentCurrency / EUR;
- }
- }
- Console.WriteLine($"{totalSum:F2} {sourceCurrency}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement