Pascal's triangle is a great choice....and before I go any further, I know what it is. My question on that though, how would I even set it up? Arrays would take to long, wouldn't they?
Originally posted by Murschech
You have touched upon one of my very favorite topics. DO NOT COMPUTE FACTORIALS! The formula you give for nCr is correct but should never be used for computing (except for tiny values of n and r.)
For instance, if you were to use your formula with n=50 and r = 49 you'd have to compute 49!, although the answer is 50. Even unsigned long integers won't work here. So what do you do? You can easily write a program based on Pascal's triangle, that is, based on the relation
nCr = (n-1)C(r-1) + (n-1)Cr
Another way (if you're not comfortable with recursion) is to use the formula
nCr = (n/r)*( (n-1)/(r-1) )*...*( (n-r+1)/1 )
Let me know if you need help with the code