pastebin - collaborative debugging tool
rathena.kpaste.net RSS


recursive_Fibonacci.txt
Posted by Anonymous on Thu 11th Oct 2012 19:15
raw | new post

  1. prontera,155,188,0      script  recursive_Fibonacci     910,{
  2.         function fibonacci;
  3.         for (set .@i,0; .@i<=15; set .@i,.@i+1) {
  4.                 dispbottom "fibonacci("+.@i+") = " + fibonacci(.@i);
  5.         }
  6.         end;
  7.  
  8.         // http://en.wikipedia.org/wiki/Fibonacci_number
  9.         function fibonacci {
  10.                 set .@n, getarg(0);
  11.                 if (.@n < 2)
  12.                         return .@n;
  13.                 return ( fibonacci(.@n-1) + fibonacci(.@n-2) );
  14.         }
  15. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at