Beispiel #1
0
        private static SimpleFraction ReductionDenominator(SimpleFraction fraction, int denominator)
        {
            if (denominator <= 0)
            {
                throw new ArgumentOutOfRangeException($"Знаминатель не может быть меньше или равен нулю.", nameof(denominator));
            }

            int fractionNumerator   = (int)(fraction.Numerator * denominator);
            int fractionDenominator = (int)(fraction.Denominator * denominator);

            return(new SimpleFraction(fractionNumerator, fractionDenominator));
        }
Beispiel #2
0
        public static SimpleFraction operator /(SimpleFraction leftFraction, SimpleFraction rightFraction)
        {
            SimpleFraction resultFraction = new SimpleFraction((int)(leftFraction.Numerator * rightFraction.Denominator), (int)(leftFraction.Denominator * rightFraction.Numerator));

            return(resultFraction);
        }