Given two complex numbers of the form and , the task is to add these two Complex Numbers.
Here the values of real and imaginary numbers is passed while calling the parametrised constructor and with the help of default(empty) constructor, the function addComp is called to get the addition of complex numbers.
Input: a1 = 4, b1 = 8 a2 = 5, b2 = 7 Output: Sum = 9 + i15 Explanation: (4 + i8) + (5 + i7) = (4 + 5) + i(8 + 7) = 9 + i15 Input: a1 = 9, b1 = 3 a2 = 6, b2 = 1 Output: Sum = 15 + i4
The following program is the illustration of the above example
Complex number 1 : 3 + i2 Complex number 2 : 9 + i5 Sum of complex number : 12 + i7
- Program to add and Subtract Complex Numbers using Class in Java
- Modular Exponentiation of Complex Numbers
- Multiplication of two complex numbers given as strings
- Program for harmonic mean of numbers
- Python program to add two numbers
- Program to find LCM of two numbers
- Program to find LCM of 2 numbers without using GCD
- Program to find GCD or HCF of two numbers
- C Program to Swap two Numbers
- Program to print non square numbers
- Program to print first n Fibonacci Numbers | Set 1
- Program to print a pattern of numbers
- Program to find first N Fermat Numbers
- Program to find sum of first n natural numbers
- Program for cube sum of first n natural numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : princi singh