(define (fibonacci n) (if (< n 3) (begin (display "NO: OF ELEMENTS SHOULD BE >= 3") 0) (fbmkr '(1 0) n)))
;basic function for making fibonacci series
(define (fbmkr ls n) (if (not (= (- n 2) 0)) (fbmkr (cons (+ (car ls) (cadr ls)) ls) (- n 1)) (reverse ls)))
;basic function for making fibonacci series
(define (fbmkr ls n) (if (not (= (- n 2) 0)) (fbmkr (cons (+ (car ls) (cadr ls)) ls) (- n 1)) (reverse ls)))
No comments:
Post a Comment