ADDITION & SUBTRACTION OF TWO COMPLEX NUMBERS USING C PROGRAM

C code:
1. Adding two complex numbers in c
2. C program for addition of two complex numbers
3. C program to add two complex numbers


#include<stdio.h>
int main(){
  int a,b,c,d,x,y;
  printf("\nEnter the first complex number:");
  scanf("%d%d",&a,&b);
  printf("\nEnter the second complex number:");
  scanf("%d%d",&c,&d);
  if(b<0)
      printf("%d-i\n",a-b);
  else
      printf("d+i\n",a+b);
  if(d<0)
      printf("d-i\n",c-d);
  else
      printf("%d+i\n",c+d);
  printf("\nADDITION ");
  x=a+c;
  y=b+d;
  if(y>0)
      printf("%d-i%d",x,-y);
  else
      printf("%d+i%d",x,+y);
  printf("\n\nSUBTRACTION ");
  x=a-c;
  y=b-d;
  if(y<0)
      printf("%d-i%d",x,-y);
  else
      printf("%d+i%d",x,+y);
  return 0;
}

9 comments:

  1. Does multiplication of complex number programing diifers from addition ? since it leads to squaring of variable whats the logic of program.

    ReplyDelete
  2. if(b<0) x="a+c;" y="b+d;">0)


    doesnt work?

    "nonportable pointer conversion"

    &

    "statment missing ;"



    sorry im just a begginer at C n would like to understand.

    ReplyDelete
  3. hi Pard
    Your code has some syntactical error. So first you should read c tutorial of this blog

    ReplyDelete
  4. hi Priya
    Addition of two matrix is very simple compare to multiplication.
    For addition of two matrix of take two for loop add each element of one matrix with corresponding element of other matrix one by one and store in another two dimensional array.
    a[i][j]=b[i][j]+c[i][j]

    ReplyDelete
  5. At our department store you can reveal sundry medication and of progression such lay Discount Viagra Pharmacy On-line the same – Cheap Generic Viagra pharmacy.

    ReplyDelete
  6. ...please where can I buy a unicorn?

    ReplyDelete
  7. Il n'y a d'aucun sens. cialis cialis

    ReplyDelete
  8. I didn't understand any thing can any one explain.

    ReplyDelete
  9. program for addition and multiplication of two complex numbers using switch case

    ReplyDelete