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
- {
- class Program
- {
- static void Main(string[] args)
- {
- decimal input = decimal.Parse(Console.ReadLine());
- string currency1 = Console.ReadLine();
- string currency2 = Console.ReadLine();
- decimal convertionOne = new decimal();
- decimal convertionTwo = new decimal();
- decimal BGN = 1;
- decimal USD = 1.79549m;
- decimal EUR = 1.95583m;
- decimal GBP = 2.53405m;
- switch(currency1)
- {
- case "BGN":
- convertionOne = input * BGN;
- break;
- case "USD":
- convertionOne = input * USD;
- break;
- case "EUR":
- convertionOne = input * EUR;
- break;
- case "GBP":
- convertionOne = input * GBP;
- break;
- }
- switch (currency2)
- {
- case "BGN":
- convertionTwo = convertionOne / BGN;
- break;
- case "USD":
- convertionTwo = convertionOne / USD;
- break;
- case "EUR":
- convertionTwo = convertionOne / EUR;
- break;
- case "GBP":
- convertionTwo = convertionOne / GBP;
- break;
- }
- Console.WriteLine(Math.Round(convertionTwo, 2));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement