1 PROGRAM PERMUTATIONEN(INPUT,OUTPUT);
4 C: ARRAY[1..10] OF INTEGER;
7 FUNCTION FAK(N: INTEGER): INTEGER;
10 ELSE FAK := N*FAK(N-1)
15 PROCEDURE WRITEPERMUTATION;
19 FOR I := 1 TO N DO WRITE( C[I] :3);
21 END (* WRITEPERMUTATION *);
25 PROCEDURE NEXTPERMUTATION;
29 WHILE C[I]>C[I+1] DO I := I-1;
31 WHILE C[J]<C[I] DO J := J-1;
32 H := C[I]; C[I] := C[J]; C[J] := H;
35 BEGIN H := C[I]; C[I] := C[J]; C[J] := H;
38 END (* NEXTPERMUTATION *);
43 WRITE("P E R M U T A T I O N E N DER ORDNUNG");
46 FOR I := 1 TO N DO C[I] := I;
48 FOR I := 2 TO FAK(N) DO