lama_byterun/lama-compiler/regression/test035.lama

18 lines
No EOL
212 B
Text

var n, i, result;
fun fact (n) {
if n <= 1
then result := 1
else
fact (n-1);
result := result * n
fi
}
n := read ();
for i := n, i >= 1, i := i-1 do
fact (i);
write (i);
write (result)
od