C++ program to calculate the sum of n complex number without class
//#include <iostream>#include<bits/stdc++.h>using namespace std;int main(){int num, i, l, j;cout << "Enter how match complex number :";cin >> i;int complex[i][2], real = 0, ima = 0;for (l = 0; l < i; l++){cout << "Enter the real number :";cin >> complex[l][1];cout << "Enter the imaganary number : i";cin >> complex[l][2];}for (l = 0; l < i; l++){cout << l + 1 << " number input is :" << complex[l][1] << " + i" << complex[l][2] << endl;}for (l = 0; l < i; l++){real += complex[l][1];ima += complex[l][2];}cout << "The sum of all is = " << real << "+ i" << ima;return 0;}
Output:
0 comments:
Post a Comment