C# Complex Addition
Description
Complex Addition
Adds two complex numbers.
Syntax
Complex.Addition
has the following syntax.
public static Complex operator +(
Complex left,
Complex right
)
Parameters
Complex.Addition
has the following parameters.
left
- The first value to add.right
- The second value to add.
Returns
Complex.Addition
method returns The sum of left and right.
Example
The following example illustrates addition with complex numbers.
/*from ww w . ja va2 s . c om*/
using System;
using System.Numerics;
public class Example
{
public static void Main()
{
Complex[] values= { new Complex(12.3, -1.4),
new Complex(8.9, 1.5) };
foreach (var c1 in values)
foreach (var c2 in values)
Console.WriteLine("{0} + {1} = {2}", c1, c2, c1 + c2);
}
}
The code above generates the following result.