Guest User

green bottles

a guest
Sep 9th, 2013
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.55 KB | None | 0 0
  1. #!/usr/bin/clisp
  2.  
  3. (defun greenbottles (x)
  4.   (loop for i downto 0 from x do
  5.         (if (not (= i 0))
  6.             (format t "~A green bottles sitting on the wall~%~A green bottles sitting on the wall~%and if one green bottle should accidentally fall there'll be ~A green bottles left on the wall ~%" i i (- i 1))
  7.             (format t "there are no more green bottles sitting on the wall"))))
  8.  
  9. (if *args*
  10.     (greenbottles (parse-integer (car *args*)))
  11.     (progn
  12.       (format t "please enter the start number of bottles~%")
  13.       (greenbottles (read))))
Advertisement
Add Comment
Please, Sign In to add comment