count from 1 to 100
if the number is divizible by three print fizz
if by 5 print bazz
if by both 3 and 5, print fizzbazz
if none of those, print the number
post your lisp solution!
Just put parentheses around your own solution!
(defun divisiblep (n d) (zerop (mod n d)))
(loop for number from 1 to 100
if (divisiblep number 3) do (princ "fizz")
if (divisiblep number 5) do (princ "bazz")
if (not (or (divisiblep number 3) (divisiblep number 5))) do (princ number)
do (terpri))
count from 1 to 100
if the number is divizible by three print fizz
if by 5 print bazz
if by both 3 and 5, print fizzbazz
if none of those, print the number
post your lisp solution!
Just put parentheses around your own solution!
(defun divisiblep (n d) (zerop (mod n d)))
(loop for number from 1 to 100
if (divisiblep number 3) do (princ "fizz")
if (divisiblep number 5) do (princ "bazz")
if (not (or (divisiblep number 3) (divisiblep number 5))) do (princ number)
do (terpri))
(use srfi-13)
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 299 |
Nodes: | 16 (2 / 14) |
Uptime: | 26:54:02 |
Calls: | 6,681 |
Calls today: | 4 |
Files: | 12,222 |
Messages: | 5,342,297 |
Posted today: | 2 |