Write a program largeHalf.c that takes in a list of 8 integers, splits the list into two halves (first 4 elements, last 4 elements), sums the elements in each half, selects the half with the larger sum, and then repeats this process with the selected list until there is only one element selected. The program should print out the half selected at each step. If the two halves have equal sum, the program should tell the user this and should always pick the first half (the one with a smaller starting index, see the example output below). Your program must include the following functions: int sumArray(int array[], int startIdx, int len) - Returns the sum of the elements in array with index startIdx to startIdx+len. void printArray(int array[], int startIdx, int len) - Print the elements in array with index startIdx to startIdx+len.
1
Expert's answer
2014-01-17T13:04:44-0500
Dear visitor, What programming language should we use?
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment