2024-07-30 16:36:33 +02:00
|
|
|
import log
|
2024-07-18 18:08:30 +02:00
|
|
|
|
2024-07-15 16:51:36 +02:00
|
|
|
main() {
|
2024-07-30 16:36:33 +02:00
|
|
|
log.number(factorial(5))
|
2024-07-15 16:51:36 +02:00
|
|
|
}
|
|
|
|
|
2025-02-17 14:31:47 +01:00
|
|
|
factorial(x int) -> int {
|
2024-07-15 16:51:36 +02:00
|
|
|
if x <= 1 {
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
return x * factorial(x - 1)
|
|
|
|
}
|