-
Matlab
Factorials are used for many different applications, such as Taylor series, combinatorial probability, permutations and modelling rate of growth. The factorial of a positive integer n is defined as:
http://i267.photobucket.com/albums/i...g?t=1271408904
Alternatively, the factorial of n can be written recursively as
http://i267.photobucket.com/albums/i...g?t=1271408957
(a) Write a function that calculates the factorial using a loop:
function f = MyFactorial(x)
(b) Write an m-file that prompts the user to enter a number and uses the function in part (a) to calculate the factorial.
-
A good problem for anyone starting out with any programming language. Where are you having problems and what have you got so far.