Skip to content
Snippets Groups Projects
Commit 960b12c3 authored by KAPIAS NICOLAS's avatar KAPIAS NICOLAS
Browse files

exercice 13/01/2025

parent 7afe732d
No related merge requests found
<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>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment