#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int m1[10][10];
int m2[10][10];
int s[10][10];
int i,j,r,c;
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
m1[i][j]=0;
m2[i][j]=0;
s[i][j]=0;
}
}
cout<<"Enter size of row and colomn:"<<endl;
cin>>r>>c;
cout<<"Enter the two matrices:"<<endl;
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cout<<"Enter elementof m1: "<<(i+1)<<(j+1)<<endl;
cin>>m1[i][j];
cout<<"Enter elementof m2: "<<(i+1)<<(j+1)<<endl;
cin>>m2[i][j];
}
}
cout<<" The first matrix is:"<<endl;
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cout<<m1[i][j];
}
cout<<"\n";
}
cout<<" The second matrix is: "<<endl;
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cout<<m2[i][j];
}
cout<<"\n";
}
cout<<"Sum of matrices is: "<<endl;
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
s[i][j]=m1[i][j]+m2[i][j];
cout<<s[i][j];
}
cout<<"\n";
}
getch();
}