Answer to Question #22994 in C++ for modi

Question #22994
Write a program that takes values from user to fill a 2 two dimensional array (Matrix) having two rows and five columns and then Hit and add and subtract and divide these two matrixes and store the result in another matrix
1
Expert's answer
2013-01-29T07:27:53-0500
#include<iostream>
using namespace std;
&
int main (){
int a[5][2],b[5][2],s=0;

for(int i=0; i<5; i++){
for (int j=0;j<2;j++){
cout<<"Enter a["<<i+1<<","<<j+1<<"] : ";
cin>>a[i][j];
}
& }
for(int i=0; i<5; i++){
for (int j=0;j<2;j++){
cout<<"Enter b["<<i+1<<","<<j+1<<"] : ";
cin>>b[i][j];
}
& }
& cout<<"add :\n";
& for(int i=0; i<5; i++){
for (int j=0;j<2;j++){
cout<<a[i][j]+b[i][j]<<" quot;;
}
cout<<endl;
& }
& cout<<"subtract :\n";
& for(int i=0; i<5; i++){
for (int j=0;j<2;j++){
cout<<a[i][j]-b[i][j]<<" quot;;
}
cout<<endl;
& }
&
&
cout<<"divide :\n";
& for(int i=0; i<5; i++){
for (int j=0;j<2;j++){
cout<<a[i][j]/b[i][j]<<" quot;;
}
cout<<endl;
& }
&
&
&
system("PAUSE"); &
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS