Articles → CSHARP → Perform The Mathematical Operations On The Complex Numbers In C#

# Perform The Mathematical Operations On The Complex Numbers In C#

```using System.Numerics;

Complex a = new Complex(2, 3); // complex number 2+3i
Complex b = new Complex(4, -1); // complex number 4-1i

Complex c = a + b; // add complex numbers a and b

Console.WriteLine("Result After addition of 2 complex Numbers:-");
Console.WriteLine(c); // output: (6, 2)

Click to Enlarge

## Subtracting

```using System.Numerics;

Complex a = new Complex(2, 3); // complex number 2+3i
Complex b = new Complex(4, -1); // complex number 4-1i

Complex c = a - b; // subtract complex numbers a and b

Console.WriteLine("Result After subtracting of 2 complex Numbers:-");
Console.WriteLine(c);

Click to Enlarge

## Multiplication

```using System.Numerics;

Complex a = new Complex(2, 3); // complex number 2+3i
Complex b = new Complex(4, -1); // complex number 4-1i

Complex c = a * b; // multiply complex numbers a and b

Console.WriteLine("Result After multiplying 2 complex Numbers:-");
Console.WriteLine(c);

Click to Enlarge

## Division

```using System.Numerics;

Complex z1 = new Complex(2, 3); // first complex number
Complex z2 = new Complex(4, -5); // second complex number
Complex result = Complex.Divide(z1, z2); // divide z1 by z2
Console.WriteLine("Result After dividing 2 complex Numbers:-");
Console.WriteLine(result); // display the result