# combinations

any body who has a program that displays the combination ( n,m )??

I don`t need to calculate the number of combinations, you can calculate them with this recursive function:

Function Comb ( n,m : word ): word;

Begin
If (n = 1) or (m = 0) or (m = n) Then
comb:= 1
Else
combinacion:= combinacion (n-1,m) + combinacion (n-1,m-1)
End;

So, I need to know what are the combinations

thanks

• [b][red]This message was edited by the iby at 2002-7-16 16:25:17[/red][/b][hr]
: any body who has a program that displays the combination ( n,m )??
:
: I don`t need to calculate the number of combinations, you can calculate them with this recursive function:
:
: Function Comb ( n,m : word ): word;
:
: Begin
: If (n = 1) or (m = 0) or (m = n) Then
: comb:= 1
: Else
: combinacion:= combinacion (n-1,m) + combinacion (n-1,m-1)
: End;
:
: So, I need to know what are the combinations
:
: thanks
:

Just run it and watch for printout:

[code]
Function Comb ( n,m : word ): word;
var t:word;
Begin
If (n = 1) or (m = 0) or (m = n) Then t:= 1
Else t:=comb(n-1,m) + comb(n-1,m-1);
writeln(n,' ',m,' ',t);
comb:=t;
End;

begin
comb(3,6);
end.
[/code]

Iby