Program :
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int a[3][3],b[3][3],c[3][3],i,j;
cout<<"Enter first matrix : ";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>a[i][j];
}
}
cout<<"Enter second matrix : ";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>b[i][j];
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
cout<<"the added matrix is : ";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<endl<<c[i][j]<<endl;
}
}
return 0;
}
Output :
0 Comments