Exemplo n.º 1
0
 static void Main(string[] args)
 {
     Fraction fraction1 = new Fraction(22, 7);
     Fraction fraction2 = new Fraction(40, 4);
     Fraction result = fraction1 + fraction2;
     Console.WriteLine(result.Numerator);
     Console.WriteLine(result.Denominator);
     Console.WriteLine(result);
 }
 public static void Main()
 {
     Fraction fraction1 = new Fraction(22, 7);
     Console.WriteLine(fraction1);
     Fraction fraction2 = new Fraction(40, 4);
     Console.WriteLine(fraction2);
     Fraction result = fraction1 + fraction2;
     Console.WriteLine(result.Numerator);
     Console.WriteLine(result.Denominator);
     Console.WriteLine(result);
     Console.WriteLine(fraction2 - fraction1);
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Fraction f1 = new Fraction(22, 7);
            Fraction f2 = new Fraction(40, 4);
            Fraction operatorPlus = f1 + f2;
            Fraction operatorMinus = f1 - f2;

            Console.WriteLine("f1: " + f1);
            Console.WriteLine("f2: " + f2);
            Console.WriteLine("Numerator: " + operatorPlus.Numerator);
            Console.WriteLine("Denominator: " + operatorPlus.Denominator);
            Console.WriteLine("Result +: " + operatorPlus);
            Console.WriteLine("Result -: " + operatorMinus);
        }