Anzzhhela98

ff

Jun 16th, 2020
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp2
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.  
  11.             double numoChange = double.Parse(Console.ReadLine());
  12.             string unit1 = Console.ReadLine();
  13.             string unit2 = Console.ReadLine();
  14.             double finishUnit = 0;
  15.             if (unit1=="mm"&& unit2=="cm")
  16.             {
  17.                 finishUnit = numoChange / 10;
  18.             }
  19.             else if (unit1 == "mm" && unit2 == "m")
  20.             {
  21.                 finishUnit = numoChange / 1000;
  22.             }
  23.             else if (unit1 == "m" && unit2 == "mm")
  24.             {
  25.                 finishUnit = numoChange * 1000;
  26.             }
  27.             else if (unit1 == "m" && unit2 == "cm")
  28.             {
  29.                 finishUnit = numoChange * 100;
  30.             }
  31.             else if (unit1 == "cm" && unit2 == "m")
  32.             {
  33.                 finishUnit = numoChange / 100;
  34.             }
  35.             else if (unit1 == "cm" && unit2 == "mm")
  36.             {
  37.                 finishUnit = numoChange * 10;
  38.             }
  39.             Console.WriteLine($"{finishUnit:f3}");
  40.        
  41.            
  42.         }
  43.  
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment