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 :: laravel print log 
Php :: send email php smtp hostinger 
Php :: php if string contains 
Php :: get order details by id woocommerce 
Php :: tipo de conexiones a la base de datos en php 
Php :: php capital string 
Php :: php set alternatives 
Php :: padding number in php 
Php :: laravel instal 
Php :: Skip WooCommerce Cart page and redirect to Checkout page 
Php :: php cors multiple headers 
Php :: error repoerting in php 
Php :: remove action from theme wordpress 
Php :: Array Contant PHP 
Php :: how login with phone in laravel 
Php :: saveAll get all id save cakephp 
Php :: how to use javascript variable in php 
Php :: delete method laravel 
Php :: message mkdir() invalid path filename drivers/session_files_driver.php 
Php :: check if session is set 
Php :: wordpress get post by id 
Php :: json url decode php 
Php :: php upload from url 
Php :: dont show file type in url 
Php :: file to binary php 
Php :: get template directory uri 
Php :: laravel database select 
Php :: pass variable to another page in js 
Php :: laravel redirect back url with message 
Php :: convert query result to array php 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =