source: liacs/coco/tests/code-generation/factest.p0@ 402

Last change on this file since 402 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: 360 bytes
RevLine 
[2]1program hoop;
2
3var
4 a: integer;
5
6function plus(a, b: integer): integer;
7
8begin
9 plus := a + b
10end;
11
12function fac(i: integer): integer;
13
14var
15 hlp: integer;
16
17begin
18 if (i = 0) then
19 fac := 1
20 else
21 begin
22 hlp := fac(i-1);
23 writeinteger(i);
24 writeinteger(hlp);
25 fac := i * hlp
26 end
27end;
28
29begin
30 a := fac(plus(3,2));
31 writeinteger(a)
32end.
Note: See TracBrowser for help on using the repository browser.