Iterative double factorial
Write an iterative function that returns the double factorial
@n@
for a natural
.
Recall that
.
For instance,
and
.
By definition,
.
Interface
| C++,C |
int double_factorial(int x);
|
| Java |
public static int doubleFactorial(int x);
|
| Python |
double_factorial(x) # returns int
|
|
double_factorial(x: int) -> int
|
Precondition
Assume
@n@
.
Observation
You only need to submit the required procedure; your main program
will be ignored.
Author: Unknown
Translator: Salvador Roura
Generation: 2026-01-25T10:19:33.423Z
© Jutge.org, 2006–2026.
https://jutge.org