Factorial
Coding Skill Exercise #4
Factorial
Given a number n, compute n factorial where n >= 0.
Knowledge Gap Finder
If you are unable to code the solution, answer the following questions and reply to this email to get customized lesson.
Was the problem statement clear to you when you read it? What did you think of doing first? Were you reminded of a construct in general or a general structure of solution that you thought would be useful? Have you previously seen problems that resemble this one? Did you feel stuck at any point while working on this problem? What did you choose as your test case? Do you think you’ve covered all possible scenarios with your tests? What program design techniques did you apply to solve this problem? Are there any constructs of the programming language that you find difficult or confusing to use? What issues make programming constructs difficult to use? For example, the keyword used, the syntax, the examples, the documentation for the construct, etc.
Feel free to forward this email to your friends so they can subscribe here https://codingskill.biz/.
excerpt: This covers the basic building block Product Accumulator. tags: productaccumulator
The factorial of a number is defined as follows:
0! = 1
1! = 1
2! = 1 ∗ 2 = 2
3! = 3 ∗ 2 ∗ 1 = 6
...
𝑛! = 𝑛 ∗ (𝑛 − 1) ∗ (𝑛 − 2) ∗ (𝑛 − 3) ∗ ... ∗ 1
Iterative Implementation


Building Block
 Product Accumulator