#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int matrix_a[3][3], matrix_b[3][3], matrix_c[3][3],
row = 0, column = 0;
cout
<< "\n\n\t __ Matrix Addition
__\t\t\tM(Rows), N(Colomn)";
cout
<< "\n\n
Elements for First Matrix -
\n";
for(row = 0; row < 3; row++)
{
for(column = 0 ; column < 3; column++)
{
cout
<< "\n Element [ " << row +1
<< " ] [ " << column +
1 << " ]
- ";
cin
>> matrix_a[row][column];
}
}
cout
<< "\n\n
Elements for Second Matrix - \n";
for(row = 0; row < 3; row++)
{
for(column = 0 ; column < 3; column++)
{
cout
<< "\n Element [ " << row +1
<< " ] [ " << column +
1 << " ]
- ";
cin
>> matrix_b[row][column];
}
}
cout
<< "\n\n
Elements for Result Matrix - \n\n\n\n";
for(row = 0; row < 3; row++)
{
for(column = 0 ; column < 3; column++)
{
matrix_c[row][column]
= matrix_a[row][column] + matrix_b[row][column];
cout
<< "\t" <<
matrix_c[row][column];
}
cout
<< "\n\n";
}
getch();
return 0;
}
No comments:
Post a Comment