This is a verified interview question from Indiamart. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Complex Number Class - IndiaMART" covers key patterns like Arrays.
"Implement the complex Numbers class that contains the following functions- 1. Constructor- You need to create the appropriate constructor. 2. Plus- This function adds two given complex numbers and updates the first complex number. e.g. if c1 = 4+i5 and c2 = 3+i1 c1.plus(c2) results in : c1 = 7+i6 and c2 = 3+i1 3. Multiply- This function multiplies two given complex numbers and updates the first complex number. e.g. if c1 = 4+i5 and c2 = 1+i2 c1.multiply(c2) results in : c1 = -6+i13 and c2 = 1+i2 4. Print- This function prints the given complex number in the following format: a+ib"
Join thousands of developers practicing for Indiamart.