Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (25 sloc) 429 Bytes
<#
data division.
working-storage section.
01 n.
procedure division.
#>
Factorial
---------
<#
perform show-factorial varying n from 1 to 10.
show-factorial section.
local result.
perform factorial using n giving result.
#>
${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.
#>
You can’t perform that action at this time.