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


 
DEFINE DATA                               
LOCAL                                     
1 #I       (I4)                           
1 #MODULO  (I4)                           
1 #DIVISOR (I4)                           
1 #OUT     (A10)                          
END-DEFINE                                
*                                         
FOR #I := 1 TO 100                        
  #DIVISOR := 15                          
  #OUT := 'FizzBuzz'                      
  PERFORM MODULO                          
*                                         
  #DIVISOR := 5                           
  #OUT := 'Buzz'                          
  PERFORM MODULO                          
*                                         
  #DIVISOR := 3                           
  #OUT := 'Fizz'                          
  PERFORM MODULO                          
*                                         
  WRITE #I                                
END-FOR                                   
*                                         
DEFINE SUBROUTINE MODULO                  
#MODULO := #I - (#I / #DIVISOR) * #DIVISOR
IF #MODULO = 0                            
  WRITE NOTITLE #OUT                      
  ESCAPE TOP                              
END-IF                                    
END-SUBROUTINE                            
*                                         
END                                       
 