- 1

Program for Calculating - (Any 4 from 6) (Any 3 from 6) (Any 2 from 6)

Hi I am using QB64 the simple BASIC programming language although the example if given may work in many languages ? And I am trying to make a program that will Calculate (Any 4 from 6) (Any 3 from 6) (Any 2 from 6) and then save the results to a .txt file It's easy to Calculate (Any 1 from 6) or (Any 5 from 6) I just need the rest and How to do it ? Cheers! :)

22nd Sep 2019, 1:48 PM
Anthony.R.Brown
2 Réponses
+ 1
Are you asking, in how many different ways can you pick 2 elements out of 6? That would be the binomial coefficient, also called "n choose r", or nCr. You calculate it like n!/(r! * (n-r)!) Where n! is the factorial of n, for example 5! = 5*4*3*2*1 = 120. In your case that would be `6 choose 2`, `6 choose 3`, etc.
22nd Sep 2019, 2:22 PM
Schindlabua
Schindlabua - avatar
0
Please don't use the Relevant Tags section to write the question copy. Hope you understand 👍
22nd Sep 2019, 2:47 PM
Ipang