PROTO INT fact(k)
FUNC VOID main()
{
  INT i, t[11]
  i := 0

  WHILE 11 -i
  DO
   {
     t[i] := fact(i)
     i := i+1
   }
  DONE
  i := 0
  WHILE 11 -i
  DO
   {
     PRINT "f(", i, ") = ", t[i], "\n"
     i := i+1
   }
  DONE
}

FUNC INT fact(n)
{
  IF n
  THEN
    RETURN n* fact(n-1)
  ELSE
    RETURN 1
  FI
}