Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 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 KonzolenKonvertor
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. decimal money = decimal.Parse(Console.ReadLine());
  14. string inCurrency = (Console.ReadLine());
  15. string outCurrency = (Console.ReadLine());
  16.  
  17. decimal BGN = 1m;
  18. decimal USD = 1.79549m;
  19. decimal EUR = 1.95583m;
  20. decimal GBP = 2.53405m;
  21.  
  22. decimal convertedCurrency = 0;
  23.  
  24. if (inCurrency == "BGN")
  25. {
  26. if (outCurrency == "USD")
  27. {
  28. convertedCurrency = money * (BGN / USD);
  29.  
  30. }
  31. else if (outCurrency == "EUR")
  32. {
  33. convertedCurrency = money * (BGN / EUR);
  34. }
  35. else if (outCurrency == "GBP")
  36. {
  37. convertedCurrency = money * (BGN / GBP);
  38. }
  39. else if (outCurrency == "BGN")
  40. {
  41. convertedCurrency = money * (BGN / BGN);
  42. }
  43.  
  44. }
  45.  
  46. else if (inCurrency == "USD")
  47. {
  48. if (outCurrency == "USD")
  49. {
  50. convertedCurrency = money * (USD / USD);
  51.  
  52. }
  53. else if (outCurrency == "EUR")
  54. {
  55. convertedCurrency = money * (USD / EUR);
  56. }
  57. else if (outCurrency == "GBP")
  58. {
  59. convertedCurrency = money * (USD / GBP);
  60. }
  61. else if (outCurrency == "BGN")
  62. {
  63. convertedCurrency = money * (USD / BGN);
  64. }
  65.  
  66. }
  67.  
  68. else if (inCurrency == "EUR")
  69. {
  70. if (outCurrency == "USD")
  71. {
  72. convertedCurrency = money * (EUR / USD);
  73.  
  74. }
  75. else if (outCurrency == "EUR")
  76. {
  77. convertedCurrency = money * (EUR / EUR);
  78. }
  79. else if (outCurrency == "GBP")
  80. {
  81. convertedCurrency = money * (EUR / GBP);
  82. }
  83. else if (outCurrency == "BGN")
  84. {
  85. convertedCurrency = money * (EUR / BGN);
  86. }
  87.  
  88. }
  89.  
  90. else if (inCurrency == "GBP")
  91. {
  92. if (outCurrency == "USD")
  93. {
  94. convertedCurrency = money * (GBP / USD);
  95.  
  96. }
  97. else if (outCurrency == "EUR")
  98. {
  99. convertedCurrency = money * (GBP / EUR);
  100. }
  101. else if (outCurrency == "GBP")
  102. {
  103. convertedCurrency = money * (GBP / GBP);
  104. }
  105. else if (outCurrency == "BGN")
  106. {
  107. convertedCurrency = money * (GBP / BGN);
  108. }
  109.  
  110. }
  111.  
  112. Console.WriteLine("{0:F2} {1}", convertedCurrency, outCurrency);
  113. }
  114. }
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement