Question: Write the method that is passed in a full array of doubles, sums up each pair of numbers in the array, and returns those values

  • Write the method that is passed in a full array of doubles, sums up each pair of numbers in the array, and returns those values in a new array.If there are an odd number of values in the array, then the last value is summed with 0:

{5, 8, 9, 2, 1, -7} returns --> {13, 11, -6} {1, 2, 3, 4, 5} returns --> {3, 7, 5}

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 Programming Questions!