Question: Write a function called sumEnds that returns the sum of the first and last elements of an array of doubles. Requirements: Do not print anything

Write a function called sumEnds that returns the sum of the first and last elements of an array of doubles.
Requirements:
Do not print anything in your function, make sure you return the sum.
You do not need to write a main function, when you submit to run the test, it has been provided for you and it will properly call your function to test it.If you want to test yourself (and you should!), remove comments in the code to provide a main function. Be sure to remove (comment out) main before submitting your code for grading.
You have been provided with the function header. The function takes two parameters.
The first is the array of doubles and the second is the number of elements in the array.
You may assume that the input array will always have at least 2 elements

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!