Task

Write a program that prints the integers from   1   to   100   (inclusive).



But:

   for multiples of three,   print   Fizz     (instead of the number)
   for multiples of five,   print   Buzz     (instead of the number)
   for multiples of both three and five,   print   FizzBuzz     (instead of the number) 


The   FizzBuzz   problem was presented as the lowest level of comprehension required to illustrate adequacy.



Also see

   (a blog)   dont-overthink-fizzbuzz
   (a blog)   fizzbuzz-the-programmers-stairway-to-heaven


100H:
 
/* DECLARE OUTPUT IN TERMS OF CP/M - 
   PL/M DOES NOT COME WITH ANY STANDARD LIBRARY */
BDOS: PROCEDURE(FUNC, ARG);
    DECLARE FUNC BYTE, ARG ADDRESS;
    GO TO 5;
END BDOS;
 
PUT$STRING: PROCEDURE(STR);
    DECLARE STR ADDRESS;
    CALL BDOS(9, STR);
    CALL BDOS(9, .(13,10,'$'));
END PUT$STRING;
 
/* PRINT A NUMBER */
PUT$NUMBER: PROCEDURE(N);
    DECLARE S (5) BYTE INITIAL ('...$');
    DECLARE P ADDRESS;
    DECLARE (N, D, C BASED P) BYTE;
    P = .S(3);
DIGIT:
    P = P-1;
    C = (N MOD 10) + '0';
    N = N/10;
    IF N > 0 THEN GO TO DIGIT;
    CALL PUT$STRING(P);
END PUT$NUMBER;
 
/* FIZZBUZZ */
DECLARE N BYTE;
DO N = 1 TO 100;
    IF N MOD 15 = 0 THEN 
        CALL PUT$STRING(.'FIZZBUZZ$');
    ELSE IF N MOD 5 = 0 THEN 
        CALL PUT$STRING(.'BUZZ$');
    ELSE IF N MOD 3 = 0 THEN 
        CALL PUT$STRING(.'FIZZ$');
    ELSE
        CALL PUT$NUMBER(N);
END;
 
/* EXIT TO CP/M */
CALL BDOS(0,0);
EOF