Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.57 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double number = double.Parse(Console.ReadLine());
  10.             string IN = Console.ReadLine();
  11.             string OUT = Console.ReadLine();
  12.            
  13.             if ( IN == "m" )
  14.             {
  15.                 if(OUT == "mm")
  16.                 {
  17.                     double mToMm = number * 1000;
  18.                     Console.WriteLine($"{mToMm:f3}");
  19.                 }
  20.                    
  21.  
  22.  
  23.                 if (OUT == "cm")
  24.                 {
  25.                     double toCm = number * 100;
  26.                     Console.WriteLine($"{toCm:f3}");
  27.                 }
  28.  
  29.             }
  30.  
  31.             else if (IN == "cm")
  32.             {
  33.                 if (OUT == "m")
  34.                 {
  35.                     double inCmToM = number / 100;
  36.                     Console.WriteLine($"{inCmToM:f3}");
  37.                 }
  38.  
  39.  
  40.                 if (OUT == "mm")
  41.                 {
  42.                     double toMm = number * 10;
  43.                     Console.WriteLine($"{toMm:f3}");
  44.                 }
  45.             }
  46.  
  47.             else if (IN == "mm")
  48.             {
  49.                 if (OUT == "cm")
  50.                 {
  51.                     double mmToCm = number / 10;
  52.                     Console.WriteLine($"{mmToCm:f3}");
  53.                 }
  54.  
  55.  
  56.                 if(OUT == "m")
  57.                 {
  58.                     double toM = number / 1000;
  59.                     Console.WriteLine($"{toM:f3}");
  60.                 }
  61.             }
  62.            
  63.         }
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement