How to perm x from n

Posted by sila on Programmers See other posts from Programmers or by sila
Published on 2011-11-19T08:52:57Z Indexed on 2011/11/19 10:15 UTC
Read the original article Hit count: 271

Filed under:

I am writing a bet settling win forms app in c#.So, I have 6 selections, 4 of them have won. I know that using the following formula =FACT(selections)/(FACT(selections-doubles))/FACT(doubles) - taken from excel but now coded into my app and working well- I can work out how many possible doubles ie AB, AC,AD,AE, BC,BD,BE, etc need to be resolved. But what I can't figure out is how to do the acutal calculation. Ie, how can I efficiently code it so that every combination A B C D has been calculated? All my efforts thus far on paper have proved to be ugly and verbose, and I was wondering if anyone could come up with an elegant solution? Ty for all and any help.

© Programmers or respective owner

Related posts about c#