fibonacci.frink

Download or view fibonacci.frink in plain text format


// Function to generate the nth item of the Fibonacci sequence.
fibonacciN[n] :=
{
   a = 0
   b = 1
   count = 0
   while count<n
   {
      [a,b] = [b, a + b]
      count = count + 1
   }
   return a
}


Download or view fibonacci.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 19572 days, 13 hours, 21 minutes ago.