F How to find factorial of a number? [using javascript] | CodeTheta

How to find factorial of a number? [using javascript]

Here is another factorial program but it is written in Javascript.
Here you can see a simple javascript code which calculate the factorial of a number. Here i used factorial function which takes two parameter f which is will calculate the factorial and the n which is number which is entered by the user.
After that it will goes to a for loop to calculate the factorial number and stored the calculated value.
First portion of the programming code is simple javascript code and second portion of the code is for create a button to calculate the factorial and input console

<script type="text/javascript">
function factorial(f,n)
what number you want to factorial:<input type="text" name="t"></br>
<input type="button" value="Calculate Factorial" onClick="factorial(this.form,t.value)"></br>
Factorial of your number is:<input type="text" name="p"></br>

Output of this program is:

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us

Post a Comment