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;
}

11 comments:

priya said...

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

Pard said...

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.

manish said...

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

manish said...

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]

Anonymous said...

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.

Anonymous said...

...please where can I buy a unicorn?

Anonymous said...

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

Anonymous said...

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

Bilal Ahmed said...

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

pradeep deepu said...

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

Absar Aarzoo said...

Please tell me the coding of this question with output....
Write a program that reads an expression from the terminal and checks if the brackets are properly matched.