Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp12
- {
- class Program
- {
- static void Main(string[] args)
- {
- double conversionNum = double.Parse(Console.ReadLine());
- string enterUnit = Console.ReadLine();
- string exitUnit = Console.ReadLine();
- double result = 0.0;
- if (enterUnit == "mm")
- {
- if (exitUnit == "cm")
- {
- result = conversionNum / 10;
- }
- else if (exitUnit == "m")
- {
- result = conversionNum / 1000;
- }
- }
- if (enterUnit == "cm")
- {
- if (exitUnit == "mm")
- {
- result = conversionNum * 10;
- }
- else if (exitUnit == "m")
- {
- result = conversionNum / 100;
- }
- }
- if (enterUnit == "m")
- {
- if (exitUnit == "cm")
- {
- result = conversionNum * 100;
- }
- else if (exitUnit == "mm")
- {
- result = conversionNum * 1000;
- }
- }
- Console.WriteLine($"{result:f3}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement