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