USING COND
(defun fibo(n)
(cond ((= n 0) 1)
((= n 1) 1)
((> n 1) (+ (fibo(- n 1)) (fibo(- n 2))))
)
)
USING IF
(defun fibo2(n)
(if (or (zerop N) (= N 1)) 1
(+ (fibo2(- n 1)) (fibo2(- n 2))))
)
(defun fibo(n)
(cond ((= n 0) 1)
((= n 1) 1)
((> n 1) (+ (fibo(- n 1)) (fibo(- n 2))))
)
)
USING IF
(defun fibo2(n)
(if (or (zerop N) (= N 1)) 1
(+ (fibo2(- n 1)) (fibo2(- n 2))))
)
Comments
Post a Comment