I'm currently working on a calculator that figures the permutation and combination.

The only problem I have is the factorial part. I don't know how I'd set that up.

In just incase you don't know what I'm talking about, here's an example of permuation and combination:

Code:
Combination:

nCr [ n! / (n-r)!r!]

Permutation:
nPr [ n! / (n-r)!]

Examples:

nCr // n = 5, r = 2

5C2 = 5! / (5-2)!2! = 5! / 3!2! = 5*4*3*2 / 3*2*2 = 5 * 2 = 10

nPr // n = 5, r = 2

5P2 = 5! / (5-2)! = 5! / 3! = 5 * 4 * 3 * 2 / 3 * 2 = 5 * 4 = 20
*Note that the [ ] 's aer in there because (n! / (n-r)!r!) would be a lil' confusing for me.