Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication2
- {
- class Program
- {
- static void Main(string[] args)
- {
- Program2.task4();
- }
- }
- class Program2
- {
- public static void task4()
- {
- var a = Console.ReadLine();
- var b = "";
- double val = double.Parse(Console.ReadLine());
- double constant;
- switch (a)
- {
- case "miles":
- constant = 1.6;
- b = "kilometers";
- break;
- case "inches":
- constant = 2.54;
- b = "centimeters";
- break;
- case "feet":
- constant = 30;
- b = "centimeters";
- break;
- case "yards":
- constant = 0.91;
- b = "meters";
- break;
- case "gallons":
- constant = 3.8;
- b = "liters";
- break;
- default:
- constant = 1;
- b = "";
- break;
- }
- Console.Write(val);
- Console.Write(" ");
- Console.Write(a);
- Console.Write(" = ");
- Console.Write(val * constant);
- Console.Write(" ");
- Console.WriteLine(b);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment