Advertisement
frxbg

Untitled

Mar 25th, 2018
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1. using System;
  2.  
  3. namespace CurrencyConverter
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string BGN = "1",USD = "1.79549", EUR = "1.95583", GBP = "2.53405";
  10.             double a = Double.Parse(BGN);
  11.  
  12.             double value = Double.Parse(Console.ReadLine());
  13.             string curr1 = Console.ReadLine();
  14.             string curr2 = Console.ReadLine();
  15.             if (curr1 == "BGN")
  16.             {
  17.                 curr1 = BGN;
  18.             }
  19.             else if (curr1 == "USD")
  20.             {
  21.                 curr1 = USD;
  22.             }
  23.             else if (curr1 == "EUR")
  24.             {
  25.                 curr1 = EUR;
  26.             }
  27.             else if (curr1 == "GBP")
  28.             {
  29.                 curr1 = GBP;
  30.             }
  31.  
  32.             if (curr2 == "BGN")
  33.             {
  34.  
  35.                 Console.WriteLine(Math.Round(value * Double.Parse(curr1), 2));
  36.             }
  37.             if (curr2 == "USD")
  38.             {
  39.                 Console.WriteLine(Math.Round((value / Double.Parse(USD)) * Double.Parse(curr1), 2));
  40.             }
  41.             if (curr2 == "EUR")
  42.             {
  43.                 Console.WriteLine(Math.Round((value / Double.Parse(EUR)) * Double.Parse(curr1), 2));
  44.             }
  45.             if (curr2 == "GBP")
  46.             {
  47.                 Console.WriteLine(Math.Round((value / Double.Parse(GBP)) * Double.Parse(curr1), 2));
  48.             }
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement