% Solutions to questions from Math 230 hour exam 2 that don't require
% writing a function.

%% Question 1, i-th partial sum.
partialSum = 0;
for j = i : n
    partialSum = partialSum + V(j);
end


%% Question 4, test whether 3-element vector is in non-decreasing order
% with at least 2 duplicates.

V(1) <= V(2) & V(2) <= V(3) & ( V(1) == V(2) | V(2) == V(3) )