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