procedure factorial(n) n := integer(n) | runerr(101, n) if n < 0 then fail return if n = 0 then 1 else n*factorial(n-1) end