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 _04_Tourist_info
- {
- class Program
- {
- static void Main(string[] args)
- {
- string initImperialUnit = Console.ReadLine();
- decimal initValue = decimal.Parse(Console.ReadLine());
- switch (initImperialUnit)
- {
- case "miles":
- Console.WriteLine($"{initValue} {initImperialUnit} = {initValue * 1.6m:F2} kilometers");
- break;
- case "inches":
- Console.WriteLine($"{initValue} {initImperialUnit} = {initValue * 2.54m:F2} centimeters");
- break;
- case "feet":
- Console.WriteLine($"{initValue} {initImperialUnit} = {initValue * 30m:F2} centimeters");
- break;
- case "yards":
- Console.WriteLine($"{initValue} {initImperialUnit} = {initValue * 0.91m:F2} meters");
- break;
- case "gallons":
- Console.WriteLine($"{initValue} {initImperialUnit} = {initValue * 3.8m:F2} iters");
- break;
- default:
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment