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