Solved

# Write an implementation of a factorial function which uses recursion. (i.e. factorial(7) -> 5040)

Posted on 2014-08-02
85 Views
I have to write an implementation of a factorial function which uses recursion. (i.e. factorial(7) -> 5040)

I have no idea what that is or how to do it.

0
Question by:brucegust

LVL 89

Accepted Solution

Factorial 7 is (7x6)=42)x5=210)x4=840)x3=2520)x2=5040.

That is the elementary definition of a factorial. Do you see how the recursion works now?
0

LVL 107

Expert Comment

Uhh, how many calculations do you want to do?  Why not just have a table of numbers and factorial values?  They never change.
0

Author Comment

Got it!

Thanks!
0

LVL 89

Expert Comment

@brucegust  - You are welcome and I was happy to help you. Good luck with the next steps.
0

## Featured Post

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…