Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

1. ## Explain Function Factorial()

Can someone break this down for me so I can understand what a factorial does?

I'm working with C and what I read doesn't make sense to me.

• Originally Posted by Jus S
Can someone break this down for me so I can understand what a factorial does?

I'm working with C and what I read doesn't make sense to me.
factorial(n) compute the product of all numbers from 1 to n:

Code:
```factorial(3) = 1*2*3
factorial(4) = 1*2*3*4
factorial(7) = 1*2*3*4*5*6*7```
probably you learn about recursivity and need one of his property:

Code:
`factorial(n) = n * factorial(n-1);`
best regards

• ## Users who have thanked oesxyl for this post:

Jus S (11-11-2008)

• Just in case you were wondering what some applications of the Factorial function are, in maths n! (factorial) returns the number of ways that n number of objects can be arranged. For example there are 7 possibilities that can go in the first place, then 6 that can go in the second spot, and so forth.
Hope this helped
happy coding.

•

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•