MATLAB: Displaying the progress of a factorial as a vector.

factorialsMATLABvectors

I'm supposed to create a function that calculates the factorial of any given number(n) and asks the user if they want to see the progression of the factorial as a vector. I've got the calculation part down but I can't seem to find a way to display the progression as a vector.
This is basically what I need:
n = 6
n! = 720
V = [6 30 120 360 720 720]
Any help will be greatly appreciated.

Best Answer

>> n = 6
n =
6
>> cumprod(n:-1:1)
ans =
6 30 120 360 720 720
Related Question