# Thread: Help With Complex Number Calculator

1. ## Help With Complex Number Calculator

Code:
```#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);
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;
}```
I was wondering how you would put do multiplication , division, and computation of the conjugate? Help Please

2. This sounds like mostly a question of mathematics. In terms of programming, you can make it easier by defining a complex number struct. (Note that <complex.h> is provided by the C standard library, though I think it is only from the 1999 edition of the C standard.)

3. right, but how would u do that? i need like an example . I'm new to this sorry :/

4. As in the struct? It could be as simple as:
Code:
```struct Complex
{
int real;
int imaginary;
};```