#C6565. Cumulative Sum
Cumulative Sum
Cumulative Sum
Given an array of integers, you are required to compute the cumulative sum array (B) such that each (B_i) is the sum of all elements from (A_0) to (A_i). Mathematically, for an input array (A), the output (B) is defined as: [ B_i = \sum_{j=0}^{i} A_j, \quad \text{for } 0 \leq i < n. ] Your task is to read the input from standard input and print the cumulative sum on standard output.
inputFormat
The first line contains an integer (n), the number of elements in the array (A). The second line contains (n) space-separated integers which represent the elements of (A).
outputFormat
Output a single line containing (n) space-separated integers, where the (i)-th integer is the cumulative sum (B_i = \sum_{j=0}^{i} A_j).## sample
4
1 2 3 4
1 3 6 10
</p>