Advertisement
kzborisov

Currency Converter

Sep 13th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 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 Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double bgnValue = 1;
  14. double usdValue = 1.79549;
  15. double eurValue = 1.95583;
  16. double gbpValue = 2.53405;
  17. double price = double.Parse(Console.ReadLine());
  18. var input = Console.ReadLine().ToLower();
  19. var output = Console.ReadLine().ToLower();
  20. double valueInput;
  21. double valueOutput;
  22.  
  23. if (input == "bgn")
  24. {
  25. valueInput = (price * bgnValue);
  26. }
  27. else if (input == "usd")
  28. {
  29. valueInput = (price * usdValue);
  30. }
  31. else if (input == "eur")
  32. {
  33. valueInput = (price * eurValue);
  34. }
  35. else
  36. {
  37. valueInput = (price * gbpValue);
  38. }
  39.  
  40. if(output == "bgn")
  41. {
  42. valueOutput = (valueInput / bgnValue);
  43. }
  44. else if(output == "usd")
  45. {
  46. valueOutput = (valueInput / usdValue);
  47. }
  48. else if (output == "eur")
  49. {
  50. valueOutput = (valueInput / eurValue);
  51. }
  52. else
  53. {
  54. valueOutput = (valueInput / gbpValue);
  55. }
  56.  
  57. Console.WriteLine($"{valueOutput:F2}");
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement