Advertisement
Oxyd

FizzBuzz

Apr 13th, 2014
1,315
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* REXX */
  2. collector3 = 3
  3. collector5 = 5
  4. fizz.  = 0
  5. buzz.  = 0
  6. fizz.3 = collector3
  7. buzz.5 = collector5
  8.  
  9. DO count=1 TO 100
  10.  SELECT
  11.         WHEN count = fizz.count & count = buzz.count THEN
  12.              DO
  13.               say 'FizzBuzz'
  14.               collector3 = collector3 + 3
  15.               collector5 = collector5 + 5
  16.               fizz.collector3 = collector3
  17.               buzz.collector5 = collector5
  18.              END
  19.         WHEN count = fizz.count THEN
  20.              DO
  21.               say 'Fizz'
  22.               collector3 = collector3 + 3
  23.               fizz.collector3 = collector3
  24.              END
  25.         WHEN count = buzz.count THEN
  26.              DO
  27.               say 'Buzz'
  28.               collector5 = collector5 + 5
  29.               buzz.collector5 = collector5
  30.              END
  31.  OTHERWISE
  32.   say count
  33.  END
  34. END
Advertisement
RAW Paste Data Copied
Advertisement