Last active
July 17, 2018 10:46
-
-
Save siddharthray/df722746f96bcdb70a2d65244d12c663 to your computer and use it in GitHub Desktop.
Factorial of a number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<script> | |
function show(){ | |
var i, no, fact; | |
fact=1; | |
no=document.getElementById("num").value; | |
for(i=1; i<=no; i++) | |
{ | |
fact= fact*i; | |
} | |
document.getElementById("answer").innerHTML= fact; | |
} | |
</script> | |
</head> | |
<body> | |
Enter Num: <input id="num"> | |
<button onclick="show()">Factorial</button> | |
<h3 id="answer"></h3> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment