lama_byterun/regression/test028.lama

18 lines
214 B
Text
Raw Normal View History

2019-09-29 02:47:07 +03:00
local n, i, result;
2018-03-27 01:51:22 +03:00
fun fact (n) {
if n <= 1
then result := 1
else
fact (n-1);
result := result * n
fi
}
2018-04-25 01:06:18 +03:00
n := read ();
2018-03-27 01:51:22 +03:00
for i := n, i >= 1, i := i-1 do
fact (i);
write (i);
write (result)
od