Link 6 Jan 130 notes Change Coin Problem»

(do ((n (read *standard-input* nil) (read *standard-input* nil))) ((null n)) 
(format t "~A cents:~%" n) (mapcar #'(lambda (x) (let ((cents (floor (/ n x)))) 
(cond ((> cents 0) (format t "~A x ~A cents~%" cents x) (setf n (- n (* cents x))))))) '(25 10 5 1)) (format t "~%"))

  1. fuckyeahterminals posted this

Design crafted by Prashanth Kamalakanthan. Powered by Tumblr.