1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| #include <stdio.h> double result_real,result_imag; void complex_prod(double real1,double imag1,double real2,double imag2); int main(void) { double imag1,imag2,real1,real2; printf("Enter 1st complex number(real and imaginary):"); scanf("%lf%lf",&real1,&imag1); printf("Enter 2nd complex number(real and imaginary):"); scanf("%lf%lf",&real2,&imag2); complex_prod(real1,imag1,real2,imag2); printf("product of complex is %f+%fi\n",result_real,result_imag); return 0; } void complex_prod(double x1,double y1,double x2,double y2) { result_real=x1*x2-y1*y2; result_imag=x1*y2+x2*y1; }
|