Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

JavaScript JS program to find the factorial of a number with form, database, and flowchart

JavaScript JS program to find the factorial of a number with form, database, and flowchart

In this tutorial, we will try to learn the followings;

  1. Flowchart of JavaScript JS program to find the factorial of a number.
  2. JavaScript JS program to find the factorial of a number.
  3. JavaScript JS program to find the factorial of a number with form.

Flowchart of JavaScript JS program to find the factorial of a number.

factorial flowchart with program

Figure: factorial flowchart with the program.

JavaScript JS program to find the factorial of a number.

<!doctype html>
<html>
<head>
<script>
function factori(){
var k, no, fact;
fact=1;
no=6;
for(k=1; k<=no; k++)  
{
fact= fact*k;
}  
document.getElementById("answer").value= fact;
}
</script>
</head>
<body>
Enter the Num: <input id="number" value="6">
<button onclick="factori()">Factorial</button>
<input id="answer">
</body>
</html>

JavaScript JS program to find the factorial of a number with form.

																																															
<html>
<head>
<script>
function showfact(){
var i, no, fact;
fact=1;
no=Number(document.getElementById("num").value);
for(j=1; j<=no; j++)  
{
fact= fact*j;
}  
document.getElementById("factorial").value= fact;
}
</script>
</head>
<body>
Enter Num: <input id="num">
<button onclick="showfact()">Factorial</button>
<input id="factorial">
</body>
</html>

Topic Covered: 

JavaScript JS program to find the factorial of a number with form, database, and flowchart.
  List of All Programs of Javascript : Click Here 
.

Prof. Fzal Rehman Shamil
Instructor, Researcher, Blogger, SEO Expert, Poet and Publisher of International Journal Of Software, Technology & Science ISSN : 2616 - 5325