🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.borland
Article #331

Re: fibonacci programme

#331
From: walt121
Date: Mon, 19 Apr 1999 00:00
31 lines
2312 bytes
In article <371B5271.B8EED898@central.ntua.gr>,
  elhadzil@central.ntua.gr wrote:

> Please could you tell me how can I put these two sentences
> r5     = sqrt(5)
> fib(n) = (((1 + r5) ** n - ((1 - r5)) ** n)) / 2 ** n / r5
> in the  procedure of my programme?

Before you do anything else, figure out how you'd do it on paper.  Use a
separate sheet of paper (variable) to hold each value, but you don't need to
hold 1000 intermediate values.	When you're done with one value for good,
slide the others down.	I'd suggest that you read some of the other messages
in this newsgroup and in other Pascal groups.  Recently, someone explained
how to create the pseudocode that will show you how to code your problem.

You pass the value n to the function or procedure. Inside the function or
procedure, you calculate the value of the nth fibonacci number.  If you're
using a function, you assign the value of the nth fibonacci number to fib. 
If you're using a procedure, you'll need another variable that is passed
using the var keyword.	This value gets assigned the value of the nth
fibonacci number.  That way, you can use the result outside the procedure.

Inside the function or procedure, break the formula down into smaller pieces,
so that you understand how the result is calculated.

--
----------�
WARNING: Anti-spam fanatic.  Keep your ads to yourself!!!

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    
Technical Details
Message-ID: <7fg10b$sls$1@nnrp1.dejanews.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <371B0391.E3122AD7@central.ntua.gr> <7ffeoa$avs$1@nnrp1.dejanews.com> <371B5271.B8EED898@central.ntua.gr>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 111659,97274d7edc98e09c
X-Google-Attributes: gid111659,public
X-Google-Thread: 108ebd,b2211ec9fb6b496
X-Google-Attributes: gid108ebd,public
From: walt121@my-dejanews.com
Subject: Re: fibonacci programme
Date: 1999/04/19
Message-ID: <7fg10b$sls$1@nnrp1.dejanews.com>
X-Deja-AN: 468394170
References: <371B0391.E3122AD7@central.ntua.gr> <7ffeoa$avs$1@nnrp1.dejanews.com> <371B5271.B8EED898@central.ntua.gr>
X-Http-Proxy: 1.0 x3.dejanews.com:80 (Squid/1.1.22) for client 207.233.102.2
Organization: Deja News - The Leader in Internet Discussion
X-Article-Creation-Date: Mon Apr 19 19:43:08 1999 GMT
Newsgroups: comp.lang.pascal.borland,borland.public.turbopascal
X-Http-User-Agent: Mozilla/3.01 (Win95; I)