Answer to Question #22034 in C++ for rodea embradura

Question #22034
write a program that allows the user to enter 10 elements for both arrays X and Y. Compute for the sum of the first elements entered and store it in array Z. Do the same for the succeeding set of elements. Display all elements contained in the 3 arrays.
1
Expert's answer
2013-01-16T12:09:18-0500

#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
int X[10];
int Y[10];
int Z[10];

for(int i=0;i<10;i++){
cout<<"Enter element "<<(i+1)<<"for array X
:";
cin>>X[i];
cout<<"Enter element "<<(i+1)<<"for array Y
:";
cin>>Y[i];
}

int Xsum;
int Ysum;

for(int i=0;i<3;i++){
Xsum+=X[i];
Ysum+=Y[i];
}
Z[0]=Xsum;
Z[1]=Ysum;
for(int i=0;i<2;i++){
cout<<Z[i]<<"
";
}
return 0;
}

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 the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS