Factorial number in php usin for loop
by saddam
<?php
$number = 5;// define the number which you want
$fc= 1;
for ($x=$number ; $x>=1; $x--) {
$fc= $fc * $x;
}
echo "Factorial $number is $fc";
?>
by saddam
<?php
$number = 5;// define the number which you want
$fc= 1;
for ($x=$number ; $x>=1; $x--) {
$fc= $fc * $x;
}
echo "Factorial $number is $fc";
?>
Comments
Post a Comment