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 add sidebar to page.php 
Php :: migrate specific migration file laravel 
Php :: string convert snake case to title case in laravel 
Php :: convert laravel hash password online 
Php :: eloquent with select 
Php :: Append a text string to WooCommerce single product title 
Php :: ubuntu install php 7 
Php :: string to array in php 
Php :: nova laravel image 
Php :: wp get tagline 
Php :: phpmyadmin reset auto_increment 
Php :: php foreach index 
Php :: php array extract value 
Php :: migration laravel 
Php :: laravel get all records order by 
Php :: Unable to connect with STARTTLS: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed 
Php :: php select option selected from database 
Php :: run a php site 
Php :: wp_enqueue_script 
Php :: users not having any role laravel spatie 
Php :: laravel 6 orderby 
Php :: laravel update return updated row, laravel update return 
Php :: laravel ignore unique on update 
Php :: send OTP php 
Php :: generate slug on create laravel 
Php :: convert scientific notation to decimal php 
Php :: laravel automatically generate unique username 
Php :: Laravel adding Foreign Key Constraints 
Php :: Increase the PHP memory limit 
Php :: return view with variable laravel 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =