Advertisement
Arxero

Untitled

Jul 9th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.17 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 _12._1_Currency_Converter
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double number = double.Parse(Console.ReadLine());
  14.             string from = Console.ReadLine();
  15.             string to = Console.ReadLine();
  16.             double USD = 1.79549;
  17.             double EUR = 1.95583;
  18.             double GBP = 2.53405;
  19.  
  20.             if (from == "BGN")
  21.                 {
  22.                 if (to == "USD")
  23.                     Console.WriteLine("{0}",Math.Round(number / USD,2));
  24.                 if (to == "EUR")
  25.                     Console.WriteLine("{0}",Math.Round(number / EUR,2));
  26.                 if (to == "GBP")
  27.                     Console.WriteLine("{0}", Math.Round(number / GBP,2));
  28.                 if (to == "BGN")
  29.                     Console.WriteLine("{0}",number);
  30.                 }
  31.             if (from == "USD")
  32.             {
  33.                 if (to == "BGN")
  34.                     Console.WriteLine("{0}", Math.Round(number*USD,2));
  35.                 if (to == "EUR")
  36.                     Console.WriteLine("{0}", Math.Round(number*USD / EUR, 2));
  37.                 if (to == "GBP")
  38.                     Console.WriteLine("{0}",Math.Round(number*USD / GBP,2));
  39.             }
  40.             if (from == "EUR")
  41.                 {
  42.                  if (to == "BGN")
  43.                     Console.WriteLine("{0}",Math.Round(number * EUR,2));
  44.                  if (to == "USD")
  45.                     Console.WriteLine("{0}",Math.Round(number * EUR / USD,2));
  46.                  if (to == "GBP")
  47.                     Console.WriteLine("{0}", Math.Round(number * EUR / GBP, 2));
  48.             }
  49.             if (from == "GBP")
  50.                 {
  51.                  if (to == "BGN")
  52.                     Console.WriteLine("{0}",Math.Round(number * GBP,2));
  53.                  if (to == "EUR")
  54.                     Console.WriteLine("{0}", Math.Round(number * GBP / EUR, 2));
  55.                  if (to == "USD")
  56.                     Console.WriteLine("{0}", Math.Round(number * GBP / USD, 2));
  57.             }
  58.  
  59.         }
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement