Skip to content

Instantly share code, notes, and snippets.

@rakotomandimby
Created September 23, 2011 16:36
Show Gist options
  • Save rakotomandimby/1237822 to your computer and use it in GitHub Desktop.
Save rakotomandimby/1237822 to your computer and use it in GitHub Desktop.
Une putain de petite epreuve que des ingénieurs n'arrive pas à reussir...
<?php
if((isset($_REQUEST['nombre']) && is_numeric($_REQUEST['nombre'])) && ($_REQUEST['nombre'] < 20))
{
$max=$_REQUEST['nombre'];
$resultat=1;
for($i=1; $i<=$max; $i++) { $resultat=$resultat*$i;}
$message="Factorielle(".$max.") => ".$resultat;
}
else
{
$message="Entrer un nombre inferieur a 20:";
}
?>
<html>
<head></head>
<body>
<?php echo $message; ?>
<form method="post" action="" >
<input type="text" name="nombre" /><br />
<input type="submit">
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment