Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.15 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 CurrencyConvertor
  8. {
  9.     class CurrencyConvertor
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double price = double.Parse(Console.ReadLine());
  14.             string enteredValue = (Console.ReadLine());
  15.             string convertedValue = (Console.ReadLine());
  16.             double convertedPrice=0.0;
  17.  
  18.             double lev = 1;
  19.             double dollar = 1.79549;
  20.             double euro = 1.95583;
  21.             double pound = 2.53405;
  22.  
  23.             if (enteredValue=="BGN")
  24.             {
  25.                 if(convertedValue=="USD")
  26.                     convertedPrice = price/dollar;
  27.                 if (convertedValue == "EUR")
  28.                     convertedPrice = price/euro;
  29.                 if (convertedValue == "GBP")
  30.                     convertedPrice = price/pound;
  31.             }
  32.             if (enteredValue == "USD")
  33.             {
  34.                 if (convertedValue == "BGN")
  35.                     convertedPrice = price * dollar;
  36.                 if (convertedValue == "EUR")
  37.                     convertedPrice = price * dollar / euro;
  38.                 if (convertedValue == "GBP")
  39.                     convertedPrice = price * dollar / pound;
  40.             }
  41.             if(enteredValue=="EUR")
  42.             {
  43.                 if (convertedValue == "BGN")
  44.                     convertedPrice = price * euro;
  45.                 if (convertedValue == "USD")
  46.                     convertedPrice = price * euro / dollar;
  47.                 if (convertedValue == "GBP")
  48.                     convertedPrice = price * euro / pound;
  49.             }
  50.             if(enteredValue=="GBP")
  51.             {
  52.                 if (convertedValue == "BGN")
  53.                     convertedPrice = price * pound;
  54.                 if (convertedValue == "EUR")
  55.                     convertedPrice = price * pound / euro;
  56.                 if (convertedValue == "USD")
  57.                     convertedPrice = price * pound / dollar;
  58.             }
  59.             Console.WriteLine("{0:f2} {1}", convertedPrice, convertedValue);
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement