diff --git a/exo8.ts b/exo8.ts
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..4cadd80683611b058c18dcab899dfc822b58b498 100644
--- a/exo8.ts
+++ b/exo8.ts
@@ -0,0 +1,14 @@
+function factorial(n: number): number {
+    if (n < 0) {
+        throw new Error("Le factoriel n'est défini que pour les entiers non négatifs.");
+    }
+    
+    let result = 1;
+    for (let i = 2; i <= n; i++) {
+        result *= i;
+    }
+    return result;
+}
+
+let n = 5;
+console.log(factorial(n));  // Affiche 120