Jump to content

Factorial: Difference between revisions

→‎{{header|Coq}}: Added Coq example
m (Solve bug for 0!)
(→‎{{header|Coq}}: Added Coq example)
Line 3,408:
 
x: 5</syntaxhighlight>
 
=={{header|Coq}}==
<syntaxhighlight lang="coq">
Fixpoint factorial (n : nat) : nat :=
match n with
| 0 => 1
| S k => (S k) * (factorial k)
end.
</syntaxhighlight>
 
=={{header|Crystal}}==
92

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.