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 value = double.Parse(Console.ReadLine());
- string inputUnit = Console.ReadLine();
- string convertedUnit = Console.ReadLine();
- double convertedValue = 0;
- if (inputUnit == "mm" && convertedUnit == "m")
- {
- convertedValue = value / 1000;
- }
- else if (inputUnit == "mm" && convertedUnit == "cm")
- {
- convertedValue = value / 10;
- }
- else if (inputUnit == "cm" && convertedUnit == "mm")
- {
- convertedValue = value * 10;
- }
- else if (inputUnit == "cm" && convertedUnit == "m")
- {
- convertedValue = value / 100;
- }
- else if (inputUnit == "m" && convertedUnit == "mm")
- {
- convertedValue = value * 1000;
- }
- else if (inputUnit == "m" && convertedUnit == "cm")
- {
- convertedValue = value * 100;
- }
- Console.WriteLine($"{convertedValue:F3}");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement