i want when i write 5 or something the result shows like that 5 x 4 x 3 x 2 x 1 = (Answer) . I thimk this called victorial or vactoria? Plz help me i want to write with javascript
Factorial... Is it something like below? function fact(a){ var b = a; for (var i=a-1; i>0; i--) b *= i; return b; }
First of all Its not Vatorial its called Factorial. Its an important concept of mathematics and calculation. Now According to your problem you can implement this like < language="JavaScript"> Function fact(var num) { var b=1; for(var i=1;i<=num;i++) { b=b*i; } } </script> you can call this by any event which you know