MODULE BinaryDigits;
IMPORT Out;
PROCEDURE OutBin(x: INTEGER);
BEGIN
IF x > 1 THEN OutBin(x DIV 2) END;
Out.Int(x MOD 2, 1);
END OutBin;
OutBin(0); Out.Ln;
OutBin(1); Out.Ln;
OutBin(2); Out.Ln;
OutBin(3); Out.Ln;
OutBin(42); Out.Ln;
END BinaryDigits.