Skip to content
Snippets Groups Projects
Commit 0baca8be authored by FUSCIELLO Baptiste's avatar FUSCIELLO Baptiste
Browse files

ajout de l'exercice 7 et maj du compte rendu

parent 49bcd31a
No related branches found
No related tags found
No related merge requests found
let n = 5;
console.log(calculerFactorielle(n));
function calculerFactorielle(n: number): number {
if (n < 0) {
throw new Error("La factorielle n'est pas définie pour les nombres négatifs.");
}
let resultat = 1;
for (let i = 1; i <= n; i++) {
resultat *= i;
}
return resultat;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment