smeghead #110(2007/07/04 06:06 GMT) [ Common Lisp ] Rating0/0=0.00
clispで確認しました。 (pyramid 4)
1 2 3 4 5 6 7 8
(defun pyramid (h) (labels ((p-line (n) (loop for i from 1 to (- h n) do (princ " ")) (loop for i from 1 to (1- (* n 2)) do (princ "*")) (terpri)) (rec (n) (unless (> n h) (p-line n) (rec (1+ n))))) (rec 1)))
Rating0/0=0.00-0+
[ reply ]
smeghead
#110()
[
Common Lisp
]
Rating0/0=0.00
(defun pyramid (h) (labels ((p-line (n) (loop for i from 1 to (- h n) do (princ " ")) (loop for i from 1 to (1- (* n 2)) do (princ "*")) (terpri)) (rec (n) (unless (> n h) (p-line n) (rec (1+ n))))) (rec 1)))Rating0/0=0.00-0+
[ reply ]