Factorial
<center>
<form action = "" method="post">
<h2>Factorial Number</h2>
<table>
<tr><td><input type="number" name="aa" /></td></tr>
<tr><td><input type="submit" name="save" value="Submit" /></td></tr>
</table>
</form>
</center>
<?php
$x=$_POST['save'];
$y=$_POST['aa'];
function getFactorial($y){
$fact=1;
for($i=1;$i<=$y;$i++)
$fact *=$i;
return $fact;
}
if(isset($x)and($y))
{
echo 'Factorial of Number : <strong>'. getFactorial($y).'</strong>';
}
?>
Fibinicci
$a=0;
$b=1;
for($i=0;$i<=10;$i++){
if($i==0){
$c=0;
}else{
$c=$a+$b;
$a=$b;
$b=$c;
}
echo $c." ";
}
?>
Comments
Post a Comment