Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace MetricConvertor
- {
- public class Program
- {
- public static void Main(string[] args)
- {
- double value = double.Parse(Console.ReadLine());
- string input = Console.ReadLine();
- string output = Console.ReadLine();
- if (input == "mm")
- {
- value /= 1000.0;
- }
- else if (input == "cm")
- {
- value /= 100.0;
- }
- else if (input == "mi")
- {
- value /= 0.000621371192;
- }
- else if (input == "in")
- {
- value /= 39.3700787;
- }
- else if (input == "km")
- {
- value /= 0.001;
- }
- else if (input == "ft")
- {
- value /= 3.2808399;
- }
- else if (input == "yd")
- {
- value /= 1.0936133;
- }
- if (output == "mm")
- {
- value *= 1000.0;
- }
- else if (output == "cm")
- {
- value *= 100.0;
- }
- else if (output == "mi")
- {
- value *= 0.000621371192;
- }
- else if (output == "in")
- {
- value *= 39.3700787;
- }
- else if (output == "km")
- {
- value *= 0.001;
- }
- else if (output == "ft")
- {
- value *= 3.2808399;
- }
- else if (output == "yd")
- {
- value *= 1.0936133;
- }
- Console.WriteLine($"{value} {output:f8}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement