Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Combinations/XPL0/combinations.xpl0
Normal file
19
Task/Combinations/XPL0/combinations.xpl0
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
code ChOut=8, CrLf=9, IntOut=11;
|
||||
def M=3, N=5;
|
||||
int A(N-1);
|
||||
|
||||
proc Combos(D, S); \Display all size M combinations of N in sorted order
|
||||
int D, S; \depth of recursion, starting value of N
|
||||
int I;
|
||||
[if D<M then \depth < size
|
||||
for I:= S to N-1 do
|
||||
[A(D):= I;
|
||||
Combos(D+1, I+1);
|
||||
]
|
||||
else [for I:= 0 to M-1 do
|
||||
[IntOut(0, A(I)); ChOut(0, ^ )];
|
||||
CrLf(0);
|
||||
];
|
||||
];
|
||||
|
||||
Combos(0, 0)
|
||||
Loading…
Add table
Add a link
Reference in a new issue