All pastes #424993 Raw Edit

Untitled

public text v1 · immutable
·published 2007-04-05 04:29 UTC
rendered paste body
$n = $_GET['n'];
$r = $_GET['r'];

//calc factorial of $n
for ($a = 1, $f = $n; $f > 1; $f--)
  {
    $a *= $f; 
  }
//calc factorial of $r
for ($k = 1, $g = $r; $g > 1; $g--)
  {
    $k *= $g; 
  }
//calc factorial of ($n - $r)
for ($m = 1, $o = ($n - $r); $o > 1; $o--)
  {
    $m *= $o; 
  }
$theanswer = $a / ($k*$o)