Displaying the progress of a factorial as a vector.

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.

 Accepted Answer

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

More Answers (0)

Categories

Find more on Debugging and Improving Code in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!