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