-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcorrectedcomplexno.txt
More file actions
31 lines (22 loc) · 809 Bytes
/
correctedcomplexno.txt
File metadata and controls
31 lines (22 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdio.h>
struct complexno {
int imagno1;
int realno1;
int imagno2;
int realno2;
};
int main() {
struct complexno compno;
printf("Enter real part of first complex number: ");
scanf("%d", &compno.realno1);
printf("Enter imaginary part of first complex number: ");
scanf("%d", &compno.imagno1);
printf("Enter real part of second complex number: ");
scanf("%d", &compno.realno2);
printf("Enter imaginary part of second complex number: ");
scanf("%d", &compno.imagno2);
int realno = (compno.realno1 * compno.realno2) - (compno.imagno1 * compno.imagno2);
int imagno = (compno.realno1 * compno.imagno2) + (compno.imagno1 * compno.realno2);
printf("Result: %d + %di\n", realno, imagno);
return 0;
}