Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

AmirhoseinPourmorad-fibonacci

(write-line "Hi , i'm Amirhosein Pourmorad, StudentNumber: 952027841")
(write-line "fibonacci prj, resource : https://en.wikipedia.org/wiki/Fibonacci_number")
(write-line "")
(defun fib(n)
(if (>= n 1)
   (print 1)
)
(setq x  0)
(setq y  1)
(setq z  0)
  (loop for i from 1 to n
   do (progn
   (setq z (+ x y))
   (format t "   ~d" z)
      (setq x y)
            (setq y z)

)
    )
)
(fib n)

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.