Advertisement
Guest User

Untitled

a guest
Jun 14th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.87 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 ConsoleApp2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             double bgnValue = 1;
  15.             double usdValue = 1.79549;
  16.             double eurValue = 1.95583;
  17.             double gbpValue = 2.53405;
  18.  
  19.             double price = double.Parse(Console.ReadLine());
  20.  
  21.             var input = Console.ReadLine();
  22.             var output = Console.ReadLine();
  23.  
  24.             double valueInput = 0;
  25.             double valueOutput = 0;
  26.  
  27.             if (input == "bgn")
  28.             {
  29.                  valueInput = (price * bgnValue);
  30.             }
  31.  
  32.             if (input == "usd")
  33.             {
  34.                  valueInput = (price * usdValue);
  35.             }
  36.  
  37.             if (input == "eur")
  38.             {
  39.                  valueInput = (price * eurValue);
  40.             }
  41.  
  42.             if (input == "gbp")
  43.             {
  44.                  valueInput = (price * gbpValue);
  45.             }
  46.  
  47.             if (output == "bgn")
  48.             {
  49.                 valueOutput = (valueInput / bgnValue);
  50.             }
  51.             if (output == "usd")
  52.             {
  53.                 valueOutput = (valueInput / usdValue);
  54.             }
  55.             if (output == "eur")
  56.             {
  57.                 valueOutput = (valueInput / eurValue);
  58.             }
  59.             if (output == "gbp")
  60.             {
  61.                 valueOutput = (valueInput / gbpValue);
  62.             }
  63.  
  64.             Console.WriteLine($"{valueOutput:F2}");
  65.  
  66.  
  67.             //Курс        USD     EUR      GBP
  68.             // 1 BGN   1.79549 1.95583 2.53405
  69.  
  70.  
  71.             //var input = Console.ReadLine();// Enter BGN, USD, EUR or GBP currency
  72.             // var output = Console.ReadLine();// Enter BGN, USD, EUR or GBP currency
  73.  
  74.  
  75.         }
  76.     }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement