#C8793. Cumulative Sum of an Array
Cumulative Sum of an Array
Cumulative Sum of an Array
Given an array of integers, your task is to compute the cumulative sum of the array. For each element at index (i), the output at index (i) should be the sum of all elements from index 0 to (i) in the original array.
For example, if the input array is [1, 2, 3, 4], the resulting cumulative sum array would be [1, 3, 6, 10].
Note: The input can be an empty array as well, in which case the output should be empty.
inputFormat
The first line of input contains a single integer (n) representing the number of elements in the array. The second line contains (n) space-separated integers representing the array elements.
outputFormat
Output the cumulative sum array as a sequence of space-separated integers in a single line. If the array is empty, output nothing.## sample
4
1 2 3 4
1 3 6 10