[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 92
  • Last Modified:

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

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.

Help, please.
0
brucegust
Asked:
brucegust
  • 2
1 Solution
 
John HurstBusiness Consultant (Owner)Commented:
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
 
Ray PaseurCommented:
Uhh, how many calculations do you want to do?  Why not just have a table of numbers and factorial values?  They never change.
0
 
brucegustAuthor Commented:
Got it!

Thanks!
0
 
John HurstBusiness Consultant (Owner)Commented:
@brucegust  - You are welcome and I was happy to help you. Good luck with the next steps.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now