at 05:50 mins
sir, why we have to take the first element of the array out side of the loop ?
and do this cumsum[0]=a[0];
cant we just run our loop from 0 itself to <n ?
like this
for(int i=0;i<n;i++)
{
cin>>a[i];
cumsum[i] = cumsum[i - 1] + a[i];
}