Factorial: Difference between revisions

m
Line 3,859:
=={{header|Ecstasy}}==
<syntaxhighlight lang="java">
module ShowFactorials {
static <Value extends IntNumber> Value factorial(Value n) {
{
static <Value extends IntNumber> Value factorial(Value n)
{
assert:arg n >= Value.zero();
return n <= Value.one() ? n : n * factorial(n-Value.one());
}
 
@Inject Console console;
void run() {
{
// 128-bit test
UInt128 bigNum = 34;
Line 3,875 ⟶ 3,872:
 
// 64-bit test
for (Int i : 10..-1) {
{
console.print($"factorial({i})={factorial(i)}");
}
}
}
}
</syntaxhighlight>
 
162

edits