Advertisement
braveheart1989

Currency_Converter

Apr 3rd, 2016
2,619
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.19 KB | None | 0 0
  1. using System;
  2.  
  3. class Currency_Converter
  4. {
  5.     static void Main(string[] args)
  6.     {
  7.         double num = double.Parse(Console.ReadLine());
  8.         var first = Console.ReadLine().ToLower();//ToLower -прави текста в малки букви
  9.         var second = Console.ReadLine().ToLower();
  10.  
  11.         if (first == "usd")
  12.         {
  13.             if (second == "bgn")
  14.             {
  15.                 Console.WriteLine("{0}", Math.Round(num * 1.79549, 2));
  16.             }
  17.             else if (second == "eur")
  18.             {
  19.                 Console.WriteLine("{0}", Math.Round(num * 0.91801, 2));
  20.             }
  21.             else if (second == "gbp")
  22.             {
  23.                 Console.WriteLine("{0}", Math.Round(num * 0.70854, 2));
  24.             }
  25.  
  26.         }
  27.  
  28.         if (first == "bgn")
  29.         {
  30.             if (second == "usd")
  31.             {
  32.                 Console.WriteLine("{0}", Math.Round(num / 1.79549, 2));
  33.             }
  34.             else if (second == "eur")
  35.             {
  36.                 Console.WriteLine("{0}", Math.Round(num / 1.95583, 2));
  37.             }
  38.             else if (second == "gbp")
  39.             {
  40.                 Console.WriteLine("{0}", Math.Round(num / 2.53405, 2));
  41.             }
  42.         }
  43.  
  44.         if (first == "eur")
  45.         {
  46.             if (second == "bgn")
  47.             {
  48.                 Console.WriteLine("{0}", Math.Round(num * 2.53405, 2));
  49.             }
  50.             else if (second == "usd")
  51.             {
  52.                 Console.WriteLine("{0}", Math.Round(num * 1.08930, 2));
  53.             }
  54.             else if (second == "gbp")
  55.             {
  56.                 Console.WriteLine("{0}", Math.Round(num * 0.77181, 2));
  57.             }
  58.         }
  59.         if (first == "gbp")
  60.             if (second == "bgn")
  61.             {
  62.                 Console.WriteLine("{0}", Math.Round(num * 0.39462, 2));
  63.             }
  64.             else if (second == "usd")
  65.             {
  66.                 Console.WriteLine("{0}", Math.Round(num * 2.53405 / 1.79549, 2));//Тука беше разликата.
  67.             }
  68.             else if (second == "eur")
  69.             {
  70.                 Console.WriteLine("{0}", Math.Round(num * 0.77181, 2));
  71.             }
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement