Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php factorial

function Factorial($n) {
  	return ($n <= 1) ? 1 : $n * Factorial($n - 1);
}
Comment

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
?> 
Comment

Program for factorial of a number in php

<?php
// PHP program to find factorial
// of given number
 
// function to find factorial
// of given number
function factorial($n)
{
    if ($n == 0)
        return 1;
    return $n * factorial($n - 1);
}
 
    // Driver Code
    $num = 5;
    echo "Factorial of ", $num, " is ", factorial($num);
 
// This code is contributed by m_kit
?>
Comment

factorial program in PHP

<?php
$no= 7;  
$fact= 1;  
$a=$no;
for($a=$no; $a>=1; $a--)  
{  
  $fact= $fact* $a;  
}  
$msg="Factorial of $no is $fact";  
?>  
<p style="color:#66CC00;font-size:40px;font-family:Mistral;">
<?Php if(isset($msg))
{
echo $msg;
} ?>
</p>
Comment

PREVIOUS NEXT
Code Example
Php :: how to read data from serial port in php 
Php :: how to add sidebar to page.php 
Php :: laravel migrate specific table 
Php :: php array has key 
Php :: php erase element from array 
Php :: laravel event generate 
Php :: define in php 
Php :: curl php 
Php :: php destroy session after some time 
Php :: $conn php 
Php :: convert to json php 
Php :: get post data in laravel 
Php :: steps to create laravel project 
Php :: cc in wp_mail 
Php :: laravel blade empty 
Php :: taxonomy_get_children drupal 8 
Php :: php artisan tinker PsyExceptionRuntimeException Unable to create PsySH runtime directory 
Php :: php createFromFormat day of week 
Php :: textarea laravel migration 
Php :: how make custom menu in wordpress 
Php :: php ofreach 
Php :: create if not exist laravel 
Php :: Displaying the category name of a custom post type 
Php :: laravel auth 6 
Php :: how to create slug in laravel 
Php :: laravel validation digits 
Php :: rand string php 
Php :: js unserialize 
Php :: laravel wherein example 
Php :: drupal 8 twig add id 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =