C program to add, subtract, multiply and divide complex numbers. It is a menu driven program in which a user will have to enter his/her choice to perform an operation and can perform operations as many times as required. To easily handle a complex number a structure named complex has been used, which consists of two integers, first integer is for real part of a complex number and second is for imaginary part.
output:
Press 1 to add two complex numbers.
Press 2 to subtract two complex numbers.
Press 3 to multiply two complex numbers.
Press 4 to divide two complex numbers.
Press 5 to exit.
Enter your choice
1
Enter a and b where a + ib is the first complex number.
a = 1
b = 2
Enter c and d where c + id is the second complex number.
c = 2
d = 3
Sum of the complex numbers = 3 + 5i
Press any key to enter choice again...
Press 1 to add two complex numbers.
Press 2 to subtract two complex numbers.
Press 3 to multiply two complex numbers.
Press 4 to divide two complex numbers.
Press 5 to exit.
Enter your choice
need an explanation for this answer? contact us directly to get an explanation for this answer