Ok so now i have been able to write the code for adding and subtracting two complex numbers in rectangular form but now need to do the same for multiplication and division in polar form.

#include<stdio.h> 
#include<stdlib.h>

struct complex

{
  int real,imag;
};

int main()
{
     struct complex x, y, z;
    printf("Please enter the two real and imaginary complex numbers (a+jb) :\n");
    printf("\nReal Number:");
    scanf("%d", &x.real);
    printf("\nImaginary Number:");
    scanf("%d", &x.imag);

    printf("\nPlease enter the next two real and imaginary complex numbers (c+jd) :\n");
    printf("\nReal Number:");
    scanf("%d", &y.real);
    printf("\nImaginary Number:");
    scanf("%d", &y.imag);

    printf("\nFrist Complex Number:%d+j%d",x.real, x.imag);
    printf("\nSecond Complex Number:%d+j%d\n",y.real, y.imag);

    z.real=x.real+y.real;
    z.imag=x.imag+y.imag;


    printf("\nThe result of the addition of the two complex numbers:%d+j%d\n",z.real, z.imag);  


   return 0;
} 

The above is the code to add two complex numbers in rectangular form.

Recommended Answers

All 2 Replies

multiplication of complex numbers
(3-2i)*(-5-4i)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.