Well, today my sister was working doing her homework and, she kind of got stressed with it, so she called me and, I ended up making it for her… I learned what a factorial is and, made this nice little function that finds the factorial of any number you pass to it. It was supposed to be written in labview, but I don’t really know what that is… so I used php xD It worked like a charm in labview according to my sister. so you can also use it in labview I guess :O

1
2
3
4
5
6
7
8
9
<?php
function factorial($input){
  $output = 1;
  for($x = $input; $x >= 1; $x--){
    $output *= $x;
  }
  return($output);
}
?>

I made an example of this function’s usage using JavaScript, check it out here

Tags: , ,