64 642
Assignments Done
99,2%
Successfully Done
In September 2018

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.
Expert's answer

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

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions