Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

C/C++ PROGRAMMING

BASIC MATHEMATICS THEME:


a) Take two complex numbers as input and compute their multiplication.
(Here you can assume ALU has the multiplier).

#include <iostream>
using namespace std;
int mian()
{
int r1 = 0, c1 = 0, r2 = 0, c2 = 0, prod_r = 0,
prod_c = 0;
cout << "Enter the first complex number as a b"
<< endl;
cin >> r1>>c1;
cout << "Enter the second complex number as c d"
<< endl;
cin >> r2>>c2;
prod_r = r1*r2 - c1*c2;
prod_c = c1*r2 + r1*c2;

cout << "THe poduct of complex number is :" <<


prod_r << "+" << prod_c << "i";
system("pause");
return 0;
getchar();
}

You might also like