Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
file 20 lines (14 sloc) 0.427 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

* using a local variable instead of an item 01 in working-storage section

local n.
perform show-factorial using n varying n from 1 to 10.

show-factorial section using n.
local result.
perform factorial using n giving result.
display n "! = " result.

factorial section using n.
local m.
if n = 1 then return n.
subtract 1 from n giving m.
perform factorial using m giving m.
multiply n by m.
return m.


Something went wrong with that request. Please try again.