Given is an array filled with integer values. For each pass, the possible elements must be summed up. I want to repeat this process until only one element remains.And I want to give intermediate results, as well as the final result on the console.
for example Input : 1,2,3,4
3 5 7.
I wrote the following method but it only do "3 5 7", how can I work with the "new array" to sum up the actual elements ?