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 :: voirs les cles etrangeres phpmyadmin 
Php :: make_dpcust 
Php :: statamic asset tag 
Php :: wp ajax error handling 
Php :: php convert datetime to timestamp 
Php :: base64 encode php check 
Php :: how to fetch data from database in php and display in pdf 
Php :: drupal 9 custom access checking for routes 
Php :: Argument #1 ($baseObject) must be of type DateTimeInterface, string given 
Php :: php get epoch timestamp of date 
Php :: how to download file in laravel 8 delelete from directry 
Php :: // Generates and prints 100 random number between 0.0 and 1.0 
Php :: how to include pdf in php page 
Php :: laravel collection min 
Php :: navigate json decode php 
Php :: character encoding to remove question marks as apostrophe php code 
Php :: not have permision elgg settings.php 
Php :: solaris 11 php mysql 
Php :: Symfony 5 - Customize Twig error templates 
Php :: laravel-5-on-shared-hosting-wrong-public-path 
Php :: How to increase the WordPress Multisite Network limit for Maximum Filesize Upload? 
Php :: run drush command from php 
Php :: php int to indonesian rupiah 
Php :: laravel helper functions 
Php :: php polymorphism 
Php :: product slider shortcode woocommerce 
Php :: WP Migrate Lite 
Php :: logout all the users from site wordpress 
Php :: setup PDO 
Java :: set size of a jframe 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =