Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace tESt
- {
- class Program
- {
- static void Main(string[] args)
- {
- double length = double.Parse(Console.ReadLine());
- string firstType = Console.ReadLine();
- string secondType = Console.ReadLine();
- const double mm = 1000;
- const double cm = 100;
- const double mi = 0.000621371192;
- const double inch = 39.3700787;
- const double km = 0.001;
- const double ft = 3.2808399;
- const double yd = 1.0936133;
- if (firstType == "mm")
- {
- length /= mm;
- }
- if (firstType == "cm")
- {
- length /= cm;
- }
- else if (firstType == "mi")
- {
- length /= mi;
- }
- else if (firstType == "in")
- {
- length /= inch;
- }
- else if (firstType == "km")
- {
- length /= km;
- }
- else if (firstType == "ft")
- {
- length /= ft;
- }
- else if (firstType == "yd")
- {
- length /= yd;
- }
- if (secondType == "cm")
- {
- length *= cm;
- }
- else if (secondType == "mi")
- {
- length *= mi;
- }
- else if (secondType == "in")
- {
- length *= inch;
- }
- else if (secondType == "km")
- {
- length *= km;
- }
- else if (secondType == "ft")
- {
- length *= ft;
- }
- else if (secondType == "yd")
- {
- length *= yd;
- }
- else if (secondType == "mm")
- {
- length *= mm;
- }
- Console.WriteLine(length);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement