Timer is Running

Product of Complex Numbers
Submissions: 602   Accuracy:


  Difficulty: Basic   Marks: 1

Given a set of complex values, find their product.

The first line contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains 2 lines, first line represents the array of real part and second line represents the array of imaginary part of the complex numbers that are to be multiplied.Each line has 5 space separated integers. 

Print the two integers real part and the imaginary part after the multiplication of the complex numbers.

1 <= T<=100

1 2 3 4 5
0 0 0 0 0
1 2 3 4 5
1 2 3 4 5

120 0
-480 -480


1) We are to multiply the 5 complex numbers and so (1+0i)*(2+0i)*(3+0i)*(4+0i)*(5+0i) we can see that answer is 120 + 0i.
2) Similarly for 2nd Testcase (1+1i)*(2+2i)*(3+3i)*(4+4i)*(5+5i) = -480 -480i

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Siddharth Dungarwal
Author: sd5869

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.