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