Project 22: Multiplying Complex Numbers

The imaginary number 'i' is defined to be the square root of -1.  Therefore, i*i = -1.

A complex number is the sum of a real number and imaginary number (i.e. 3 + 5i)

Multiplying Complex Numbers Example:


(3 + 4i)(2 - 5i) = 6 - 15i + 8i -20i^2 = 26 - 7i

Project 22: Variables 'real1', 'imag1', 'real2', 'imag2' have been initialized.  

real1 is the real part of the first complex number (3 in the example above)

imag1 is the imaginary part of the first complex number (4 in the example above)

real2 is the real part of the second complex number (2 in the example above)

imag2 is the imaginary part of the second complex number (-5 in the example above)

Task: Appropriately initialize the variables 'prodReal' and 'prodImag' that correspond to the complex number that is the product of the two given complex numbers.

**If your code works for 5 test cases in a row, you can enter your e-mail address.