Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- struct complex
- {
- int real, img;
- };
- int main()
- {
- struct complex p, q, r;
- printf("Enter p and q where (p + iq) is the first complex number.\n");
- scanf("%d%d", &p.real, &p.img);
- printf("Enter r and s where (r + is) is the second complex number.\n");
- scanf("%d%d", &q.real, &q.img);
- r.real = p.real + q.real;
- r.img = p.img + q.img;
- printf("Sum of the complex numbers: (%d) + (%di)\n", r.real, r.img);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement