using namespace std;
int main()
{
//Two Dimensional Array
int a[50][50],b[50][50],c[50][50];
int c1,r1,m,n;
cout<< "Enter the number of columns : ";
cin>>c1;
cout<< "Enter the number of rows : ";
cin>>r1;
cout<< "Enter the element of of First Array : "<<endl;
for(n=0;n<c1;n++){
for(m=0;m<c1;m++){
cin>>a[n][m];
}}
cout<< "Enter the element of of Second Array : "<<endl;
for(n=0;n<r1;n++){
for(m=0;m<r1;m++){
cin>>b[n][m];
}}
cout<< "The sum of two Matrices are : "<<endl;
for (n=0;n<c1;n++){
for(m=0;m<r1;m++){
c[n][m]=a[n][m]+b[n][m];
cout<<a[n][m]<< " + "<<b[n][m]<< " = "<<c[n][m]<<endl;
}}
return 0;
}
No comments:
Post a Comment