C# Complex Add

Description

Complex Add Adds two complex numbers and returns the result.

Syntax

Complex.Add has the following syntax.


public static Complex Add(
  Complex left,
  Complex right
)

Parameters

Complex.Add has the following parameters.

  • left - The first complex number to add.
  • right - The second complex number to add.

Returns

Complex.Add method returns The sum of left and right.

Example


using System;//from   w w w  . ja v a  2s .c o m
using System.Numerics;

public class Example
{
   public static void Main()
   {
      Complex[] values= { new Complex(1.3, -1.4), 
                          new Complex(-1.2, 3.1), 
                          new Complex(1.9, 1.5) };   
      foreach (var c1 in values)
         foreach (var c2 in values)
            Console.WriteLine("{0} + {1} = {2}", c1, c2, 
                              Complex.Add(c1, c2));
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Numerics »




BigInteger
Complex