Answers for "write a php class that calculates the factorial of an integer"

PHP
0

php program to find factorial of a number using function

function Factorial($number){ 
    if($number <= 1){   
        return 1;   
    }   
    else{   
        return $number * Factorial($number - 1);   
    }   
} 
  
$number = 5; 
$fact = Factorial($number); 
echo "Factorial = $fact";  //output : 120
?>
Posted by: Guest on October-16-2020

Code answers related to "write a php class that calculates the factorial of an integer"

Browse Popular Code Answers by Language