Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
1,045
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.87 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 convertorZaMerniEdinici
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var num = double.Parse(Console.ReadLine());
  14.             var from = Console.ReadLine();
  15.             var to = Console.ReadLine();
  16.            
  17.  
  18.             if (from == "mm")
  19.             {
  20.                 num = num / 1000;
  21.             }
  22.             else if (from == "cm")
  23.             {
  24.                 num = num / 100;
  25.             }
  26.             else if (from == "mi")
  27.             {
  28.                 num = num / 0.000621371192;
  29.             }
  30.             else if (from == "in")
  31.             {
  32.                 num = num / 39.3700787;
  33.             }
  34.             else if (from == "km")
  35.             {
  36.                 num = num / 0.001;
  37.             }
  38.             else if (from == "ft")
  39.             {
  40.                 num = num / 3.2808399;
  41.             }
  42.             else if (from == "yd")
  43.             {
  44.                 num = num / 1.0936133;
  45.             }
  46.             if (to == "mm")
  47.             {
  48.                 num = num * 1000;
  49.             }
  50.             else if (to == "cm")
  51.             {
  52.                 num = num * 100;
  53.             }
  54.             else if (to == "mi")
  55.             {
  56.                 num = num * 0.000621371192;
  57.             }
  58.             else if (to == "in")
  59.             {
  60.                 num = num * 39.3700787;
  61.             }
  62.             else if (to == "km")
  63.             {
  64.                 num = num * 0.001;
  65.             }
  66.             else if (to == "ft")
  67.             {
  68.                 num = num * 3.2808399;
  69.             }
  70.             else if (to == "yd")
  71.             {
  72.                 num = num * 1.0936133;
  73.             }
  74.             Console.WriteLine("{0} {1}", num, to);
  75.  
  76.         }
  77.     }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement