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