Write a program that sets each element in a vector equal to the sum of the corre
ID: 3631408 • Letter: W
Question
Write a program that sets each element in a vector equal to the sum of the corresponding elements in two other vectors in a crossed manner. Ex: If vector A has the values 2,3,5,8 and vector B has the values 1,0,4,6 then the resulting vector C should have values 8,7,5,9 (so 2+6, 3+4, 5+0, and 8+1). The program should read in two vectors A and B, and return the values for C. Assume that the vector elements are all integers and that the input vectors are of equal length.Programming is not my thing at all. I have been lost and have been struggling in this class from day one. Thank you in advance for your help!
Explanation / Answer
#include #define n 12 //inplace of 12 write size of array your array int main() { int A[n],B[n],C[n],i,j; for(i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.