# Subtraction of two complex number in python by R4R Team

- here we perform subtraction of two complex.
- In subtraction of two complex, real part are subtract by real part and imaginary part is subtract by imaginary part.

Example-

first complex is 1+2j
second complex is 2+1j
subtraction of first to second is -1+1j

first complex is 5+2j
second complex is -1+0j
subtraction of first to second is 6+2j

program-

print("Enter first complex number")
n1=complex(input())
print("Enter second complex number")
n2=complex(input())

print("First complex is ",n1)
print("Second complex is ",n2)
print("Subtraction of second complex number by first number is ",n1-n2)

output-

Enter first complex number
1+7j
Enter second complex number
-3-4j
First complex is (1+7j)
Second complex is (-3-4j)
Subtraction of second complex number by first number is (4+11j)

Enter first complex number
-1-4j
Enter second complex number
0+2j
First complex is (-1-4j)
Second complex is 2j
Subtraction of second complex number by first number is (-1-6j)

-In this program, we take input of two complex number by complex(input()) and subtract both number by '-' operator and print that subtraction.
-How complex(input()) works ? actually input() function take input of string i.e. 1+2j then by complex() we doing type casting here which convert string into required complex number.