Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

find a factorial of a number

<?php
              
      $num = 3;
      $factorial = 1;
      if($num != 0) {
        for($i = $num; $i>=1; $i--) {
          $factorial = $factorial * $i;
        }
      }
      else {
        $factorial = 1;
      }
      echo "Factorial of $num is $factorial";

    ?>
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #find #factorial #number
ADD COMMENT
Topic
Name
8+3 =