Skip to content

Instantly share code, notes, and snippets.

Created July 22, 2016 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/0cacfc9378f5965d03b0303f6a3dddd9 to your computer and use it in GitHub Desktop.
Save anonymous/0cacfc9378f5965d03b0303f6a3dddd9 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace units_convertor
{
class Program
{
static void Main(string[] args)
{
//m, mm, cm, mi, in, km, ft, yd
var amount = double.Parse(Console.ReadLine());
var unit = Console.ReadLine();
var conversionUnit = Console.ReadLine();
if (unit == "m" && conversionUnit == "m")
{
double type1 = amount / 1;
double result = (type1 * 3.2808399);
Console.WriteLine(result + " m");
}
else if (unit == "m" && conversionUnit == "mm")
{
double type2 = (amount * 1000) / 1;
Console.WriteLine(type2);
}
else if (unit == "m" && conversionUnit == "cm")
{
double type2 = (amount * 100) / 1;
Console.WriteLine(type2);
}
else if (unit == "m" && conversionUnit == "mi")
{
double type2 = (amount / 0.000621371192);
Console.WriteLine(type2);
}
else if (unit == "m" && conversionUnit == "in")
{
double type2 = (amount * 39.3700787);
Console.WriteLine(type2);
}
else if (unit == "m" && conversionUnit == "km")
{
double type2 = (amount / 1000);
Console.WriteLine(type2);
}
else if (unit == "m" && conversionUnit == "ft")
{
double type2 = (amount * 3.2808399);
Console.WriteLine(type2);
}
else if (unit == "m" && conversionUnit == "yd")
{
double type2 = (amount * 1.0936133);
Console.WriteLine(type2);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment