%% Cumulative Product of Vector
% Find the cumulative product of the integers from 1 to 5. The element B(2) is the product of A(1) and A(2), while B(5) is the product of elements A(1) through A(5).

A = 1:5;
B = cumprod(A)

% Copyright 2012 The MathWorks, Inc.