Advertisement
plamen83

value convertor

Mar 19th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.56 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 _09.Converter4MeasuringUnits
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var value = double.Parse(Console.ReadLine());
  14.             var firstCurrency = Console.ReadLine();
  15.             var secondCurrency = Console.ReadLine();
  16.  
  17.             var firstValue = 0d;
  18.             var seconValue = 0d;
  19.  
  20.             var eu = 1.95583;
  21.             var us = 1.79549;
  22.             var gb = 2.53405;
  23.             var bg = 1d;
  24.  
  25.             if (firstCurrency == "BGN")
  26.            
  27.                 firstValue = bg;
  28.            
  29.             else if (firstCurrency == "USD")
  30.            
  31.                 firstValue = us;
  32.            
  33.             else if (firstCurrency == "EUR")
  34.            
  35.                 firstValue = eu;
  36.            
  37.             else if (firstCurrency == "GBP")
  38.            
  39.                 firstValue = gb;
  40.            
  41.             if (secondCurrency == "BGN")
  42.            
  43.                 seconValue = bg;
  44.            
  45.             else if (secondCurrency == "USD")
  46.            
  47.                 seconValue = us;
  48.            
  49.             else if (secondCurrency == "EUR")
  50.            
  51.                 seconValue = eu;
  52.            
  53.             else if (secondCurrency == "GBP")
  54.            
  55.                 seconValue = gb;
  56.            
  57.  
  58.             var result = value * (firstValue / seconValue);
  59.             Console.WriteLine(Math.Round(result, 2));
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement