#include <iostream>
using namespace std;
int main()
{
float arr1[3][3],arr2[3][3],arrSum[3][3];
cout << "Enter 1st matrix elements : " << endl;
for(int i=0; i<3; i++){
for(int j=0; j<3; j++){
cin >> arr1[i][j];
}
}
cout << "Enter 2nd matrix elements :" << endl;
for(int i=0; i<3; i++){
for(int j=0; j<3; j++){
cin >> arr2[i][j];
}
}
cout << "Fisrt matrix is :" << endl;
for(int i=0; i<3; i++){
for(int j=0; j<3; j++){
cout << arr1[i][j];
} cout << endl;
}
cout << "2nd matrix is :" << endl;
for(int i=0; i<3; i++){
for(int j=0; j<3; j++){
cout << arr2[i][j];
} cout << endl;
}
cout << "The sum of these two matrix is :" << endl;
for(int i=0; i<3; i++){
for(int j=0; j<3; j++){
arrSum[i][j] = arr1[i][j]+arr2[i][j];
cout << arrSum[i][j];
} cout << endl;
}system("PAUSE"); return 0;
}
program for the Addition of two matrix
Posted on at