private string Calc( int M , int N)
{
List < int > Numbers = new ArrayList();
int X = M / N;
M = M % N;
StringBuilder Result = new StringBuilder ();
while (M != 0 && ! Numbers . Contains(M))
{
Numbers . Add(M);
Result . Append(M * 10 / N);
M = M * 10 % N;
}
if (M != 0 )
{
int i = Numbers . IndexOf(M);
return x + "." + Result . ToString() . Substring( 0 , i) +
"(" + Result . ToString() . Substring(i) + ")" ;
}
else return x + "." + Result . ToString();
}