#include<stdio.h>
#include<conio.h>
#include<iostream.h>
void main()
{
int r1,c1,r2,c2,a[10][10],b[10][10],c[10][10];
clrscr();
cout<<"Enter how many row in first matrics A : ";
cin>>r1;
cout<<"Enter how many column in first matrics A : ";
cin>>c1;
for(int i=0;i<r1;i++)
for(int j=0;j<c1;j++)
cin>>a[i][j];
cout<<"Enter how many row in second matrics B : ";
cin>>r2;
cout<<"Enter how many column in second matrics B : ";
cin>>c2;
for(i=0;i<r2;i++)
for(j=0;j<c2;j++)
cin>>b[i][j];
if(r1==r2 && c1==c2)
{
for(i=0;i<r1;i++)
for(j=0;j<c1;j++)
c[i][j]=a[i][j]+b[i][j];
cout<<"\nThe sum of A & B is : \n";
for(i=0;i<r1;i++)
{
for(j=0;j<c1;j++)
cout<<" "<<c[i][j];
cout<<"\n\n";
}
}
getch();
}
///////////////////////////////////////////////////////////////////////////
Copy & paste this code in your TC & run, then you will get output.......
If you have any problem please comment below.........