Last change
on this file since 36 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:
681 bytes
|
Rev | Line | |
---|
[2] | 1 | program fibonee;
|
---|
| 2 |
|
---|
| 3 | var
|
---|
| 4 | hlp: integer;
|
---|
| 5 |
|
---|
| 6 | function fibo(i: integer): integer;
|
---|
| 7 |
|
---|
| 8 | begin
|
---|
| 9 | writeinteger(i);
|
---|
| 10 | if (i <= 1) then
|
---|
| 11 | fibo := 1
|
---|
| 12 | else
|
---|
| 13 | fibo := fibo(i-1) + fibo(i-2)
|
---|
| 14 | end;
|
---|
| 15 |
|
---|
| 16 | function plus(i: integer): integer;
|
---|
| 17 |
|
---|
| 18 | begin
|
---|
| 19 | plus := i + 1
|
---|
| 20 | end;
|
---|
| 21 |
|
---|
| 22 | function geennaam(i: integer): integer;
|
---|
| 23 |
|
---|
| 24 | begin
|
---|
| 25 | if (i > 0) then
|
---|
| 26 | geennaam := 1 + geennaam(i-1)
|
---|
| 27 | else
|
---|
| 28 | geennaam := 0
|
---|
| 29 | end;
|
---|
| 30 |
|
---|
| 31 | function dubbeltest(i: integer): integer;
|
---|
| 32 |
|
---|
| 33 | begin
|
---|
| 34 | if (i = 0) then
|
---|
| 35 | dubbeltest := 23
|
---|
| 36 | else
|
---|
| 37 | dubbeltest := dubbeltest(0) + dubbeltest(0)
|
---|
| 38 | end;
|
---|
| 39 |
|
---|
| 40 |
|
---|
| 41 | begin
|
---|
| 42 | hlp := fibo(4);
|
---|
| 43 | writereal(3.5);
|
---|
| 44 | writeinteger(hlp);
|
---|
| 45 | writeinteger(plus(4));
|
---|
| 46 | writeinteger(geennaam(6));
|
---|
| 47 | writeinteger(dubbeltest(666))
|
---|
| 48 | end.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.