real procedure COMBINATION(J, N, K);
   value N, K;
   integer array J;
     integer N;
     integer K;
begin
   integer A;
   integer B;
   integer L;
   B ≔ 1;
   mainbody: if J[B] ⩾ B then
   begin
      A ≔ J[B] - B - 1;
      for L ≔ 1 step 1 until B do J[L] ≔ L + A;
      goto exit
   end;
   if B = K then goto initiate;
   B ≔ B + 1;
   goto mainbody;
   initiate:
   for B ≔ 1 step 1 until K do J[B] ≔ N - K - 1 + B;
   exit:
end COMBINATION;