Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Fibonnaci sequence...
Author Message
not_l33t

Posted: Wed May 12, 2004 7:22 pm   Post subject: Fibonnaci sequence...

How do I assimilate that sequence so I can out put its sequence.

I tried this one, but it doesn't work. It is supposed to add the 2 preceeding numbers but I am gettting out of ideas.

 code: var b :int put "Enter the number you want to go up to" get b for i : 1 .. b     put (i-1)+(i-2) end for
Sponsor
Sponsor

AsianSensation

Posted: Wed May 12, 2004 9:23 pm   Post subject: (No subject)

recursion.

 code: fcn Fib (a : int, b : int) : int     put b     delay (1000)     result Fib (b, a + b) end Fib put 1 put Fib (1, 1)
not_l33t

Posted: Wed May 12, 2004 9:33 pm   Post subject: (No subject)

AsianSensation wrote:
recursion.

 code: fcn Fib (a : int, b : int) : int     put b     delay (1000)     result Fib (b, a + b) end Fib put 1 put Fib (1, 1)

Thank you very much. Amazing stuff. Can you explain the first line.
Tony

Posted: Wed May 12, 2004 10:05 pm   Post subject: (No subject)

eh... fcn is the short form for function. Similary, proc is short for procedure (which is a function that doesn't return a value... silly HoltSoft )
Tony's programming blog. DWITE - a programming contest.
AsianSensation

Posted: Wed May 12, 2004 10:21 pm   Post subject: (No subject)

lol, i have yet to find a short form for processes. maybe prcs ?
not_l33t

Posted: Thu May 13, 2004 5:10 pm   Post subject: (No subject)

Seriously, I don't get it. I have never used the function command. Neither do I get the logic of it. I am really sorry but can you explain it to me? Please?
Tony

Posted: Thu May 13, 2004 5:16 pm   Post subject: (No subject)

function a block of code that returns a value. Same as functions covered in math.

y = 2x

in turing that would be
 code: function y(x:int):int return 2*x end y put y(2)
Tony's programming blog. DWITE - a programming contest.
not_l33t

Posted: Thu May 13, 2004 5:18 pm   Post subject: (No subject)

tony wrote:
function a block of code that returns a value. Same as functions covered in math.

y = 2x

in turing that would be
 code: function y(x:int):int return 2*x end y put y(2)

All hail the Turing Lord.
Sponsor
Sponsor

 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 8 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: