Python Program to Multiply Two Complex Numbers

A complex number is represented by a + bi or a + bj. Python handles complex numbers using complex data types. Python uses a+bj notation. Python programming language converts the real numbers a and b into complex using the function complex(a,b).

Python handles simple operation like addition, subtraction, multiplication and division directly. For more advanced operation on complex numbers you can use cmath library.

This python program multiplies two complex number given by user and displays the output.

Python Source Code: Multiplication of Two Complex Numbers


# Python program to multiply two complex number

# Enter first complex number i.e. 3+4j not 3+4i
first = complex(input('Enter first complex number: '))
second = complex(input('Enter first complex number: '))

# Multiplication of complex number
product = first * second

# Displaying Sum
print('PRODUCT = ', product)

Output of Above Program

Enter first complex number: 2+3j
Enter first complex number: 4+6j
PRODUCT =  (-10+24j)