Advertisement
ShadowEmbrace

Factorial Division

Oct 29th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1. <?php
  2.  
  3. $num1 = intval(readline());
  4. $num2 = intval(readline());
  5.  
  6. $factorial1 = printFactorial($num1);
  7. $factorial2 = printFactorial($num2);
  8.  
  9. printf("%.2f", ($factorial1/$factorial2));
  10.  
  11. function printFactorial(int $n): float{
  12.     $result = 1;
  13.     for ($i = 1; $i <= $n; $i++){
  14.         $result *= $i;
  15.     }
  16.     return $result;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement