Advertisement
Guest User

Metric Converter

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