HOW DO I CALCULATE THE FACTORIAL OF A NUMBER?
Do you understand what a factorial means?
Do you know how to work it out by hand, using pencil and paper?
Computer Science textbooks typically take factorial calculation as an example for recursive functions.
The 8051 is particularly unsuited to recursive functions, so that would not be a good choice if you're thinking of doing it on an 8051. An iterative approach would be more appropriate.
In general, recursion is best avoided in embedded systems...
Few functions are so well suited for an iterative solution as the factorial. I have never really understood why the factorial is the #1 example of recursion.