Addition Of Two Matrices

in Hindi - Addition Of Two Matrices



not yet

Source Code :

RUN#include <iostream>
using namespace std;

int main()
{
int m1[2][2], m2[2][2], m3[2][2];
int r, c;

cout<<"Enter elements of matrix m1[2][2]: "<<endl;
for(r=0; r<2; r++)
{
for(c=0; c<2; c++)
{
cin>>m1[r][c];
}
}

cout<<"\nEnter elements of matrix m2[2][2]: "<<endl;
for(r=0; r<2; r++)
{
for(c=0; c<2; c++)
{
cin>>m2[r][c];
}
}

for(r=0; r<2; r++)
{
for(c=0; c<2; c++)
{
m3[r][c] = m1[r][c] + m2[r][c];
}
}

cout<<"\nAddition of matrix m1 and matrix m2 \n";
for(r=0; r<2; r++)
{
for(c=0; c<2; c++)
{
cout<<m3[r][c]<<endl;
}
}
return 0;
}