From 960b12c3ae45cc9c01ef096eeffaff89c9507ae8 Mon Sep 17 00:00:00 2001
From: KAPIAS NICOLAS <nicolas.kapias@etu.unistra.fr>
Date: Mon, 13 Jan 2025 09:37:46 +0100
Subject: [PATCH] exercice 13/01/2025

---
 factoriel.php | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100755 factoriel.php

diff --git a/factoriel.php b/factoriel.php
new file mode 100755
index 0000000..fa51a12
--- /dev/null
+++ b/factoriel.php
@@ -0,0 +1,25 @@
+<html>
+	<head>
+		<title>M2GPI</title>
+	</head>
+	<body>
+		<form method="POST" action="factoriel.php">
+			<input type="submit" name="calcul" value="Calculer"/>
+			le factoriel de : <input type="number" name="input_value"/>		
+		</form>
+		<?php
+			if (isset($_POST['calcul'])) {
+				
+				$input_value = $_POST['input_value'];
+				$factoriel = 1;
+
+				for ($i=$_POST['input_value']; $i > 0 ; $i--) {
+					echo $factoriel . " * " . $i . "<br>";
+					$factoriel = $factoriel * $i;
+				}
+
+				echo "Le factoriel de " . $_POST['input_value'] . " est " . $factoriel;
+			}
+		?>
+	</body>
+</html>
-- 
GitLab