Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me to do this on C program: Write a function named VectorPlusVector to compute the element by element sum of two vectors. The
Please help me to do this on C program:
Write a function named VectorPlusVector to compute the element by element sum of two vectors. The desired output is a vector, but since we can't output a vector from a C function, we will declare the results vector as a global variable. Inputs: 1. Input vector 1 (double) 2. Input vector 2 (double) 3. Length of vectors (int) Output: None! (See explanation above.) Function pseudocode: Use a for loop to add each element in input vector 1 to the corresponding element in input vector 2 and assign the sum to the corresponding element in the global results vector. Prototype your function above main() so that the function itself can come after main(). Intrusions for main(): Call your function from main() with {1.1, 2.1, 3.1, 4.1, 5.1} and {1.5, 1.4, 1.3, 1.2, 1.1} as the input vectors, and a length of 5. Use printf inside a for loop to print the values of the results vectorStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started