Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

factorial function php

function Factorial($number){ 
    if($number <= 1){   
        return 1;   
    }   
    else{   
        return $number * Factorial($number - 1);   
    }   
} 
  
$number = 5; 
$fact = Factorial($number); 
echo "Factorial = $fact";  //output : 120
?> 
 
PREVIOUS NEXT
Tagged: #factorial #function #php
ADD COMMENT
Topic
Name
5+8 =