Dsa
Arrays
Easy
Cumulative Sum Array
Implement a program that computes the cumulative (prefix) sum of an integer array. The input will be given in the following format:
- The first line will contain n (1 <= n <= 1000).
- The second line will contain n integers, which are the elements of the array.
Output a single line with the cumulative sum array.
Example:
Input:
4
1 2 3 4
Output:
1 3 6 10
Key concepts
arrayssumprefix sums
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now