Guest User

Untitled

a guest
Oct 5th, 2016
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. using System;
  2.  
  3. class CurrencyConverter
  4. {
  5. static void Main(string[] args)
  6. {
  7.  
  8.  
  9. decimal moneyToString = decimal.Parse(Console.ReadLine());
  10. string firstcurrency = Console.ReadLine();
  11. string secondcurrency = Console.ReadLine();
  12. decimal firstRate = 0.0m;
  13. decimal secondRate = 0.0m;
  14.  
  15. if (firstcurrency == "BGN")
  16. {
  17. firstRate = 1;
  18. }
  19. else if (firstcurrency == "USD")
  20. {
  21. firstRate = 1.79549m;
  22. }
  23. else if (firstcurrency == "EUR")
  24. {
  25. firstRate = 1.95583m;
  26. }
  27. else if (firstcurrency == "GBP")
  28. {
  29. firstRate = 2.53405m;
  30. }
  31. if (secondcurrency == "BGN")
  32. {
  33. secondRate = 1;
  34. }
  35. else if (secondcurrency == "USD")
  36. {
  37. secondRate = 1.79549m;
  38. }
  39. else if (secondcurrency == "EUR")
  40. {
  41. secondRate = 1.95583m;
  42. }
  43. else if (secondcurrency == "GBP")
  44. {
  45. secondRate = 2.53405m;
  46. }
  47.  
  48. decimal result = moneyToString * (firstRate / secondRate);
  49.  
  50. Console.WriteLine("{0} {1}",Math.Round(result,2),secondcurrency);
  51. }
  52. }
Add Comment
Please, Sign In to add comment