#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# combinations

Member Posts: 1
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

• Member Posts: 323
[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

• Member Posts: 0

_________ \ http://forcoder.org \ free ebooks and video tutorials about < Visual Basic MATLAB JavaScript Go Scratch Ruby Objective-C Swift PHP Visual Basic .NET Assembly R C++ Python Java C Delphi Perl PL/SQL C# Scheme Lua Dart ABAP ML Prolog F# Scala Alice Clojure FoxPro Transact-SQL Ada Bash Crystal Logo Hack Lisp COBOL Rust SAS LabVIEW Erlang Awk Kotlin VBScript Julia Apex D Fortran /> _