string result = default(string);
Console.WriteLine("Input:");
string input = Console.ReadLine();
try
{
double inputnum = Convert.ToDouble(input);
string[] array = inputnum.ToString().Split('.');
int len = array[1].Length;
int num = Convert.ToInt32(Math.Pow(10, len));
int value = Convert.ToInt32(inputnum * num);
int a = value;
int b = num;
while (a != b)
{
if (a > b)
a = a - b;
else
b = b - a;
}
value = value / a;
num = num / a;
result = string.Format("{0}/{1}", value, num);
}
catch (Exception)
{
result = input.ToString();
}
Console.WriteLine("Result:{0}", result);
Console.ReadLine();