Ejemplo n.º 1
0
 /// <summary>
 /// Subtraction
 /// </summary>
 /// <param name="First">First fraction</param>
 /// <param name="Second">Second fraction</param>
 /// <returns>The subtracted fraction</returns>
 public static Fraction operator -(Fraction First, Fraction Second)
 {
     Fraction Value1 = new Fraction(First.Numerator * (int)Second.Denominator, First.Denominator * Second.Denominator);
     Fraction Value2 = new Fraction(Second.Numerator * (int)First.Denominator, Second.Denominator * First.Denominator);
     Fraction Result = new Fraction(Value1.Numerator - Value2.Numerator, Value1.Denominator);
     Result.Reduce();
     return Result;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Multiplication
 /// </summary>
 /// <param name="First">First fraction</param>
 /// <param name="Second">Second fraction</param>
 /// <returns>The resulting fraction</returns>
 public static Fraction operator *(Fraction First, Fraction Second)
 {
     Fraction Result = new Fraction(First.Numerator * Second.Numerator, First.Denominator * Second.Denominator);
     Result.Reduce();
     return Result;
 }