Task

Produce a sequential count in octal,   starting at zero,   and using an increment of a one for each consecutive number.

Each number should appear on a single line,   and the program should count until terminated,   or until the maximum value of the numeric type in use is reached.



Related task

   Integer sequence   is a similar task without the use of octal numbers.


 
BEGIN
 
    PROCEDURE OUTOCT(N); INTEGER N;
    BEGIN
        PROCEDURE OCT(N); INTEGER N;
        BEGIN
            IF N > 0 THEN BEGIN
                OCT(N//8);
                OUTCHAR(CHAR(RANK('0')+MOD(N,8)));
            END;
        END OCT;
        IF N < 0 THEN BEGIN OUTCHAR('-'); OUTOCT(-N); END
        ELSE IF N = 0 THEN OUTCHAR('0')
        ELSE OCT(N);
    END OUTOCT;
 
    INTEGER I;
    WHILE I < MAXINT DO BEGIN
        OUTINT(I,0);
        OUTTEXT(" => ");
        OUTOCT(I);
        OUTIMAGE;
        I := I+1;
    END;
END.
 