Write a Python program to add, subtract, multiply and division of two complex numbers


This program is written in Python and it performs arithmetic operations on two complex numbers. The program uses the format (a+bj) to represent complex numbers, where a is the real part and b is the imaginary part. The j represents the square root of -1, which is the imaginary unit in mathematics.

The program performs four arithmetic operations on two complex numbers: addition, subtraction, multiplication, and division.

  • In the first line of code, the program adds two complex numbers using the + operator and prints the result on the console using the print() function. The two complex numbers are (2+5j) and (5-3j).
  • In the second line of code, the program subtracts two complex numbers using the - operator and prints the result on the console using the print() function.
  • In the third line of code, the program multiplies two complex numbers using the * operator and prints the result on the console using the print() function.
  • In the fourth line of code, the program divides two complex numbers using the / operator and prints the result on the console using the print() function.
  • Overall, this program provides a simple implementation of how to perform arithmetic operations on complex numbers in Python using the built-in operators +, -, *, and /. It can be used to quickly perform complex number operations in Python.

Source Code

print("Addition of Two Complex Numbers : ",(2+5j)+(5-3j))
print("Subtraction of Two Complex Numbers : ",(2+5j)-(5-3j))
print("Multiplication of Two Complex Numbers : ",(2+5j)*(5-3j))
print("Division of Two Complex Numbers : ",(2+5j)/(5-3j))

Output

Addition of Two Complex Numbers : (7+2j)
Subtraction of Two Complex Numbers : (-3+8j)
Multiplication of Two Complex Numbers : (25+19j)
Division of Two Complex Numbers : (-0.14705882352941177+0.911764705882353j)

Example Programs