Пример #1
0
 static int CommonRationals(Rational a, Rational b, out int newA, out int newB)
 {
     if (a.Denominator == b.Denominator)
     {
         newA = a.Numerator;
         newB = b.Numerator;
         return(a.Denominator);
     }
     else
     {
         int lcm = Functions.LCM(a.Denominator, b.Denominator);
         newA = a.Numerator * (lcm / a.Denominator);
         newB = b.Numerator * (lcm / b.Denominator);
         return(lcm);
     }
 }