Factorial: Difference between revisions
Content added Content deleted
PatGarrett (talk | contribs) m (→{{header|360 Assembly}}: Better editing) |
(Jakt) |
||
Line 5,205: | Line 5,205: | ||
7710530113353860041446393977750283605955564018160102391634109940339708518270930693670907697955390330926478612242306774446597851526397454014801846531749097625044706382742591201733097017026108750929188168469858421505936237186038616420630788341172340985137252...</syntaxhighlight> |
7710530113353860041446393977750283605955564018160102391634109940339708518270930693670907697955390330926478612242306774446597851526397454014801846531749097625044706382742591201733097017026108750929188168469858421505936237186038616420630788341172340985137252...</syntaxhighlight> |
||
</div> |
</div> |
||
=={{header|Jakt}}== |
|||
<syntaxhighlight lang="jakt"> |
|||
fn factorial(anon n: i64) throws -> i64 { |
|||
if n < 0 { |
|||
throw Error::from_string_literal("Factorial's operand must be non-negative") |
|||
} |
|||
mut result = 1 |
|||
for i in 1..(n + 1) { |
|||
result *= i |
|||
} |
|||
return result |
|||
} |
|||
fn main() { |
|||
for i in 0..11 { |
|||
println("{} factorial is {}", i, factorial(i)) |
|||
} |
|||
} |
|||
</syntaxhighlight> |
|||
=={{header|Janet}}== |
=={{header|Janet}}== |