Advertisement
nikolayneykov

Untitled

Oct 16th, 2018
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.16 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4.     static void Main(string[] args)
  5.     {
  6.         double money = double.Parse(Console.ReadLine());
  7.         string firstCurrency = Console.ReadLine();
  8.         string secondCurrency = Console.ReadLine();
  9.         double USD = 1.79549;
  10.         double EUR = 1.95583;
  11.         double GBR = 2.53405;
  12.  
  13.         double total = 0;
  14.  
  15.         if (firstCurrency == "BGN")
  16.         {
  17.             total = money;
  18.  
  19.             if (secondCurrency == "USD")
  20.             {
  21.                 total = money / USD;
  22.             }
  23.             else if (secondCurrency == "GBP")
  24.             {
  25.                 total = money / GBR;
  26.             }
  27.             else if (secondCurrency == "EUR")
  28.             {
  29.                 total = money / EUR;
  30.             }
  31.         }
  32.         else if (firstCurrency == "USD")
  33.         {
  34.             total = money;
  35.  
  36.             if (secondCurrency == "BGN")
  37.             {
  38.                 total = money * USD;
  39.             }
  40.             else if (secondCurrency == "EUR")
  41.             {
  42.                 total = money * USD / EUR;
  43.             }
  44.             else if (secondCurrency == "GBR")
  45.             {
  46.                 total = money * USD / GBR;
  47.             }
  48.         }
  49.         else if (firstCurrency == "EUR")
  50.         {
  51.             total = money;
  52.  
  53.             if (secondCurrency == "BGN")
  54.             {
  55.                 total = money * EUR;
  56.             }
  57.             else if (secondCurrency == "USD")
  58.             {
  59.                 total = money * EUR / USD;
  60.             }
  61.             else if (secondCurrency == "GBR")
  62.             {
  63.                 total = money * EUR / GBR;
  64.             }
  65.         }
  66.         else if (firstCurrency == "GBR")
  67.         {
  68.             total = money;
  69.  
  70.             if (secondCurrency == "BGN")
  71.             {
  72.                 total = money * GBR;
  73.             }
  74.             else if (secondCurrency == "USD")
  75.             {
  76.                 total = money * GBR / USD;
  77.             }
  78.             else if (secondCurrency == "EUR")
  79.             {
  80.                 total = money * GBR / EUR;
  81.             }
  82.         }
  83.  
  84.         Console.WriteLine($"{total:F2} {secondCurrency}");
  85.     }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement