Factorial in AWK
Example for versions
Jawk 1.02,
gawk 3.1.6,
mawk 1.3.3
This example uses iterative factorial definition. Individual statements within code block can be separated with semicolons (;
) or new lines.
BEGIN {
f = 1
print "0! = " f
for (i=1; i<17; i++) {
f *= i
print i "! = " f
}
}
Comments
]]>blog comments powered by Disqus
]]>