Last change
on this file since 133 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:
522 bytes
|
Rev | Line | |
---|
[2] | 1 | program fibonee;
|
---|
| 2 |
|
---|
| 3 | var
|
---|
| 4 | hlp: integer;
|
---|
| 5 |
|
---|
| 6 | function fibo(i: integer): integer;
|
---|
| 7 |
|
---|
| 8 | begin
|
---|
| 9 | if (i <= 1) then
|
---|
| 10 | fibo := 1
|
---|
| 11 | else
|
---|
| 12 | fibo := fibo(i-1) + fibo(i-2)
|
---|
| 13 | end;
|
---|
| 14 |
|
---|
| 15 | function plus(i: integer): integer;
|
---|
| 16 |
|
---|
| 17 | begin
|
---|
| 18 | plus := i + 1
|
---|
| 19 | end;
|
---|
| 20 |
|
---|
| 21 | function geennaam(i: integer): integer;
|
---|
| 22 |
|
---|
| 23 | begin
|
---|
| 24 | if (geennaam > 0) then { geennaam is used as function call without parameter}
|
---|
| 25 | geennaam := 1 + geennaam(i-1)
|
---|
| 26 | else
|
---|
| 27 | geennaam := 0
|
---|
| 28 | end;
|
---|
| 29 |
|
---|
| 30 | begin
|
---|
| 31 | hlp := fibo(7);
|
---|
| 32 | writeinteger(hlp);
|
---|
| 33 | writeinteger(plus(4));
|
---|
| 34 | writeinteger(geennaam(6))
|
---|
| 35 | end.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.