mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-05 22:38:44 +00:00
16 lines
189 B
Text
16 lines
189 B
Text
|
|
fun fact (n) {
|
||
|
|
if n <= 1
|
||
|
|
then result := 1
|
||
|
|
else
|
||
|
|
fact (n-1);
|
||
|
|
result := result * n
|
||
|
|
fi
|
||
|
|
}
|
||
|
|
|
||
|
|
read (n);
|
||
|
|
|
||
|
|
for i := n, i >= 1, i := i-1 do
|
||
|
|
fact (i);
|
||
|
|
write (i);
|
||
|
|
write (result)
|
||
|
|
od
|