Last change
on this file since 291 was 2, checked in by Rick van der Zwet, 15 years ago |
Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)
|
File size:
387 bytes
|
Rev | Line | |
---|
[2] | 1 | program fibonee;
|
---|
| 2 |
|
---|
| 3 | var
|
---|
| 4 | hlp: integer;
|
---|
| 5 |
|
---|
| 6 | function fibo(i: integer): integer;
|
---|
| 7 |
|
---|
| 8 | var hlp1, hlp2: integer;
|
---|
| 9 |
|
---|
| 10 | begin
|
---|
| 11 | writeinteger(i);
|
---|
| 12 | if (i <= 1) then
|
---|
| 13 | begin
|
---|
| 14 | { writeinteger(-1); }
|
---|
| 15 | fibo := 1
|
---|
| 16 | end
|
---|
| 17 | else
|
---|
| 18 | begin
|
---|
| 19 | hlp1 := fibo(i-1);
|
---|
| 20 | hlp2 := fibo(i-2);
|
---|
| 21 | { writeinteger(-(hlp1+hlp2)); }
|
---|
| 22 | fibo := hlp1 + hlp2
|
---|
| 23 | end
|
---|
| 24 | end;
|
---|
| 25 |
|
---|
| 26 |
|
---|
| 27 | begin
|
---|
| 28 | hlp := fibo(12);
|
---|
| 29 | writeinteger(hlp)
|
---|
| 30 | end.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.