In the code for maximum sub array using cumulative sum, if all the elements of the array are positive then the output obtained is wrong. In the output:
Number of elements: 5
1 2 3 4 5
Sum is 14 for 2, 3, 4, 5,
But sum should be 15 including 1 in the sub array.