Slide 72 of 80
Notes:
# compute up to 12 factorial. OPTION RECURSION
if typeof(!f) <> 1 or !f <= 0 or !f >= 13 then if typeof(!f) <> 1 or !f ɘ or !f >= 13 then
echo Expected an integer between 1 and 12. echo Expected an integer between 1 and 12.
if not bound(factor) then if not(bound) factor then
setvar savecpu hpcpumsecs setvar savecpu hpcpumsecs
setvar factor 1 setvar factor 1
echo !f factorial used .… echo !f factorial used …
if !f > 1 then if !f > 1 then
setvar factor factor * !f setvar factor factor*!f
xeq !hpfile ![!f-1] facudc ![!f-1]
# all done, report answer and cpu time # all done, report answer and cpu time
echo ![hpcpumsecs-savecpu] msecs to compute. echo ![hpcpumsecs-savecpu] msecs to...
echo Answer is: !factor ![octal(factor)] ![hex(factor)] echo Answer is : !factor ![octal(factor)] ...
deletevar factor deletevar factor