function A = matrixCSums_nonvec(M)
% M is a numeric matrix and A has the same size as M.
% Each element in A is the sum of the corresponding element in M and all
% the elements above it.  Example:
%   M = [ 1 3; ...             A = [ 1  3; ...
%         4 5; ...                   5  8; ...
%        -7 2]         then         -2 10]
% Do NOT use any built-in functions other than size

[nr, nc]= size(M);

for c= 1:nc
    A(1,c)= M(r,c);
end

for r= 2:nr
    for c=1:nc
        A(r,c)= M(r,c) + A(r-1,c); 
    end
end
