Interview Solution

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are–by definition–not smart enough to debug it. Brian Kernighan

Complex number

Language Java | Level Intermediate | Category Interview Problems | July 24, 2015 4:52 pm

Comments


Interview Problem

A complex number is a combination of real and imaginary numbers. A+Bi is a complex number where A is the real number and B is the imaginary number.
A complex number is a number that can be expressed in the form a + bi, where a and b are real numbers and i is the imaginary unit,
Example:-
3+4i
3 - real number
4 - imaginary number


Output

   					 
Add:8.0+6.0i + 4.0+5.0i = 12.0+11.0i
Subtract:8.0+6.0i - 4.0+5.0i = 4.0+1.0i
Multiply:8.0+6.0i * 4.0+5.0i = 2.0+64.0i

				    

Comments



Please login to add comments.