3 of 8 bug free solution

PHP, 56 bytes

<? $r=$i=$argv[1];while($i>1){$i--;$r=$r*$i;} echo $r;?>

Proof it works:

root@raspberrypi:~# php fact.php 5
120root@raspberrypi:~#

This is a list of bugs:

  • there is no \n
  • throws error if no parameter
  • 0! seems to be 0

This is a snippet (100 bytes) which does not have these bugs:

<? $r=$i=(isset($argv[1])?$argv[1]:0);if($i==0)$r=1;else while($i>1){$i--;$r=$r*$i;} echo $r."\n";?>