Use the formulas s1 1 and sn sn1 n for n 2 to write a rec
Use the formulas s1 = 1 and sn = sn1 · n for n 2 to write a recursive algorithm that computes sn = n! You may use any style of pseudo-code to write your algorithm, but make sure that the steps of your algorithm are clear
Solution
PSEUDO-CODE
1. Factorial(parameter : n)
 2.    if n equal to 1 then
 3.       Return (1)
 4.   else
 5.       Return ((Call Factorial(argument: n-1))*n)
 6. Call Factorial(argument: n)
ALGORITHM: Factorial(positive integer n)
Input: n positive integer
 Output: factorial of n
Sample Run
Factorial(parameter : 4)
 Factorial(parameter : 3) * 4
 Factorial(parameter : 2) * 3 * 4
 Factorial(parameter : 1) * 2 * 3 * 4
 1 * 2 * 3 * 4
returns 24

