Question: This problematic program should sum together all of the numbers in both input arrays and returns that sum as the output. ( assuming array 1

This problematic program should sum together all of the numbers in both input arrays and returns that sum as the output. (assuming array1 and array2 have same length) Which one of the following statements is a reasonable correction? (Note: the correction may not fully fix the function)
function [totalSum]= programToFix(array1,array2)
totalSum =1; ?1
n = array1;
for i =1:1:n ?2
totalSum = array1(i)+ array2(i)+ totalSum; ?3
end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!