0% found this document useful (0 votes)
122 views1 page

Recursive Factorial Algorithm Guide

The algorithm uses recursion to calculate the factorial of a number. It takes a number n as input, and returns its factorial f as output. If n is 0, f is set to 1; otherwise, it recursively calls itself with n-1 and multiplies the result by n.

Uploaded by

Kellie Lewis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views1 page

Recursive Factorial Algorithm Guide

The algorithm uses recursion to calculate the factorial of a number. It takes a number n as input, and returns its factorial f as output. If n is 0, f is set to 1; otherwise, it recursively calls itself with n-1 and multiplies the result by n.

Uploaded by

Kellie Lewis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

The recursion algorithm for finding the factorial of a number is

given below,
Algorithm : factorial-recursion
Input : n, the number whose factorial is to be found.
Output : f, the factorial of n
Method : if(n=0)
f=1
else
f=factorial(n-1) * n
if end
algorithm ends.

You might also like