1(* 2 * Copyright (c) 1980 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)recur.p 5.1 (Berkeley) 04/16/91 8 *) 9 10program recursion(input, output); 11var i : integer; 12 13function fact(n : integer) : integer; 14begin 15 if n <= 1 then begin 16 fact := 1; 17 end else begin 18 fact := n * fact(n-1); 19 end; 20end; 21 22begin 23 i := 3; 24 writeln(i:1, '! = ', fact(i):1); 25end. 26