Factorial: Difference between revisions

324 bytes added ,  10 months ago
m
mNo edit summary
Line 1,493:
 
==={{header|Craft Basic}}===
<syntaxhighlight lang="basic">'factorialaccurate examplebetween 1-12
'accurate between 1-12
 
print "version 1 without function"
let f = 1
 
for i = 1 to 12
alert "factorial"
input "enter an integer: ", n
 
let n = i
do
let f = 1
 
do
let f = f * n
let n = n - 1
 
let f = f * n
loop n > 0
let n = n - 1
 
loop n > 0
print f
 
print f, " ",
end</syntaxhighlight>
wait
 
next i
 
print newline, newline, "version 2 with function"
 
for i = 1 to 12
 
alert print "factorial(i), " ",
 
endnext i</syntaxhighlight>
{{out| Output}}<pre>version 1 without function
1 2 6 24 120 720 5040 40320 362880 3628800 39916800 479001600
 
version 2 with function
1 2 6 24 120 720 5040 40320 362880 3628800 39916800 479001600 </pre>
 
==={{header|FreeBASIC}}===
305

edits