Computer Science, asked by nabinkumars07, 1 year ago

write a program in c++ using function to find the addition of two matrices

Answers

Answered by Farye
1
cout<<"Enter matrix 1 elements :";
for(i=0; i<3; i++)
{ for(j=0; j<3; j++)
{ cin>>mat1[i][j];
} }
cout<<"Enter matrix 2 elements :";
for(i=0; i<3; i++) {
for(j=0; j<3; j++) {
cin>>mat2[i][j];
} }
cout<<"Adding the two matrix to form the third matrix .....\n";
for(i=0; i<3; i++) {
for(j=0; j<3; j++) { mat3[i][j]=mat1[i][j]+mat2[i][j];
} }

cout<<"The two matrix added successfully...!!"; cout<<"The new matrix will be :\n";
for(i=0; i<3; i++) {
for(j=0; j<3; j++)
{
cout<<mat3[i][j]<<" ";
} cout<<"\n";
}
getch();
Similar questions