esercizi in php
This commit is contained in:
48
php_1_3.php
Normal file
48
php_1_3.php
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
<?php
|
||||
|
||||
include ('header.html');
|
||||
|
||||
///////////////////////////
|
||||
echo<<<_css
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
_css;
|
||||
echo "\n";
|
||||
///////////////////////////
|
||||
|
||||
|
||||
|
||||
for ($i=1;$i<=9;$i++){
|
||||
|
||||
echo "<p>\n";
|
||||
echo "$i : " . fattoriale($i);
|
||||
|
||||
echo "</p>\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
include ('footer.html');
|
||||
|
||||
|
||||
function fattoriale ($input){
|
||||
|
||||
if ($input == 1){
|
||||
return 1;
|
||||
} else {
|
||||
return (fattoriale($input -1 ) * $input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user