The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Fact
By Guest on 20th February 2024 05:59:36 AM | Syntax: PHP | Views: 62



New Paste New paste | Download Paste Download | Toggle Line Numbers Show/Hide line no. | Copy Paste Copy text to clipboard
  1. <?php
  2.         if($_GET["num"]){
  3.          $number=$_GET["num"];
  4.          function Factorial($number){
  5.             $factorial = 1;
  6.             for ($i = 1; $i <= $number; $i++){
  7.             $factorial *= $i;
  8.             }
  9.             return $factorial;
  10.         }
  11.         $fact=Factorial($number);
  12.         echo"Factorial of ".$_GET['num']." is ".$fact;
  13.         exit();
  14. }
  15. ?>
  16. <html>
  17.         <body>
  18.                 <form action='<?php $_PHP_SELF?>'method="GET">
  19.                         Enter no:<input type="text" name="num"/>
  20.                         <input type="submit"/>          
  21.         </form>
  22.         </body>
  23. </html>





fact