30 lines
287 B
Text
30 lines
287 B
Text
;Factorial example program for x86 DOS
|
|
;Compiles to 207 bytes com executable
|
|
|
|
program examples\fctrl
|
|
|
|
data
|
|
|
|
int f[1]
|
|
int n[0]
|
|
|
|
begin
|
|
|
|
echo "Factorial"
|
|
echo "Enter an integer: "
|
|
|
|
input [n]
|
|
|
|
label loop
|
|
|
|
[f] = [f] * [n]
|
|
|
|
-1 [n]
|
|
|
|
if [n] > 0 then loop
|
|
|
|
echo [f]
|
|
pause
|
|
kill
|
|
|
|
end
|