Posted By

mscribellito on 02/09/11


Tagged


Versions (?)

Factorial


 / Published in: PHP
 

  1. function factorial($n) {
  2.  
  3. $f = 1;
  4. if ($n > 1) {
  5. for ($i = 2; $i <= $n; $i++) {
  6. $f *= $i;
  7. }
  8. }
  9. return $f;
  10.  
  11. }

Report this snippet  

You need to login to post a comment.