PROCEDURE IntToString (x: INTEGER; VAR s: ARRAY OF CHAR): INTEGER; VAR j, k: INTEGER; ch: CHAR; a: ARRAY 32 OF CHAR; BEGIN IF x = 0 THEN s := "0" ELSE IF x < 0 THEN s[0] := "-"; k := 1; x := -x ELSE k := 0 END; j := 0; REPEAT a[j] := CHR(x MOD 10 + ORD("0")); x := x DIV 10; INC(j) UNTIL x = 0; REPEAT DEC(j); ch := a[j]; s[k] := ch; INC(k) UNTIL j = 0; s[k] := 0X END; RETURN k END IntToString;