Advertisement
VZhelev

Currency Converter

May 30th, 2017
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 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 SoftUni
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double value = double.Parse(Console.ReadLine());
  14.             string from = Console.ReadLine();
  15.             string to = Console.ReadLine();
  16.             double x = 0;
  17.             double y = 0;
  18.  
  19.             switch(from)
  20.             {
  21.                 case "BGN": x = 1; break;
  22.                 case "USD": x = 1.79549; break;
  23.                 case "EUR": x = 1.95583; break;
  24.                 case "GBP": x = 2.53405; break;
  25.             }
  26.             switch (to)
  27.             {
  28.                 case "BGN": y = 1; break;
  29.                 case "USD": y = 1.79549; break;
  30.                 case "EUR": y = 1.95583; break;
  31.                 case "GBP": y = 2.53405; break;
  32.             }
  33.  
  34.             Console.Write(Math.Round((value*x)/y,2) + " " + to);
  35.  
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement