Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.52 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace CurrencyConverter
  8. {
  9.     class CurrencyConverter
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             decimal num = decimal.Parse(Console.ReadLine());
  14.             string firstCurrency = Console.ReadLine();
  15.             string secondCurrency = Console.ReadLine();
  16.             decimal firstValue = 0.0m;
  17.             decimal secondValue = 0.0m;
  18.             if (firstCurrency == "BGN")
  19.             {
  20.                 firstValue = 1;
  21.             }
  22.             else if (firstCurrency == "USD")
  23.             {
  24.                 firstValue = 1.79549m;
  25.             }
  26.             else if (firstCurrency == "EUR")
  27.             {
  28.                 firstValue = 1.95583m;
  29.             }    
  30.             else if (firstCurrency == "GBP")
  31.             {
  32.                 firstValue = 2.53405m;
  33.             }
  34.             if (secondCurrency == "BGN")
  35.             {
  36.                 secondValue = 1;
  37.             }
  38.             else if (secondCurrency == "USD")
  39.             {
  40.                 secondValue = 1.79549m;
  41.             }
  42.             else if (secondCurrency == "EUR")
  43.             {
  44.                 secondValue = 1.95583m;
  45.             }
  46.             else if (secondCurrency == "GBP")
  47.             {
  48.                 secondValue = 2.53405m;
  49.             }
  50.             decimal result = num * (firstValue / secondValue);
  51.             Console.WriteLine(Math.Round(result, 2));
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement