Answer:
see explaination
Explanation:
#include<iostream>
using namespace std;
main()
{
int rows,columns,first[10][10], second[10][10], sum[10][10],difference[10][10],i,j;
cout << "Enter number of rows:";
cin >> rows;
cout << "Enter number of columns:";
cin>> columns;
cout << "Enter the elements of first matrix\n";
for ( i = 0 ; i < rows ;i++ )
{
for ( j = 0 ; j < columns ; j++ )
cin >> first[i][j];
}
cout << "Enter the elements of second matrix\n";
for ( i = 0 ; i < rows ;i++ )
{
for ( j = 0 ; j < columns ; j++ )
cin >> second[i][j];
}
for ( i = 0 ; i < rows ;i++ )
{
for ( j = 0 ; j < columns ; j++ )
sum[i][j] = first[i][j] + second[i][j];
}
for ( i = 0 ; i < rows ;i++ )
{
for ( j = 0 ; j < columns ; j++ )
sum[i][j] = first[i][j] + second[i][j];
}
for ( i = 0 ; i < rows ;i++ )
{
for ( j = 0 ; j < columns ; j++ )
difference[i][j] = first[i][j] - second[i][j];
}
cout << "Sum of entered matrices:-\n";
for ( i = 0 ; i < rows ;i++ )
{
for ( j = 0 ; j < columns ; j++ )
cout << sum[i][j] << "\t";
cout << endl;
}
cout << "Difference of entered matrices:-\n";
for ( i = 0 ; i < rows ;i++ )
{
for ( j = 0 ; j < columns ; j++ )
cout << difference[i][j] << "\t";
cout << endl;
}
return 0;
}
see attachment for output