#include<iostream.h>
#include<conio.h>
void main()
{
int a[10][10],b[10][10],c[10][10],i,j,m,n;
clrscr();
cout<<"Enter the number of raws and columns of two matrices : ";
cin>>m>>n;
cout<<"Enter the elements into matrix A\n";
for(i=0;i<m;i++)
for(j=0;j<n;j++)
cin>>a[i][j];
cout<<"\nEnter the elements into matrix B\n";
for(i=0;i<m;i++)
for(j=0;j<n;j++)
cin>>b[i][j];
for(i=0;i<m;i++)
for(j=0;j<n;j++)
c[i][j]=a[i][j]+b[i][j];
for(i=0;i<m;i++)
{
cout<<"\n";
for(j=0;j<n;j++)
cout<<c[i][j];
cout<<"\t";
}
getch();
}
No comments:
Post a Comment