Factorial with HTML, javascript & jQuery
Views: 506
Demo
Code
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
</script>
<script>
$(document).ready(function() {
$("#answer").click(function() {
var n = $("#number").val();
$("#result").val((+n) * ((+n) + (1)) / (2))
});
});
</script>
</head>
<body>
<div>
Enter your factorial number:
<input type="text" id="number"><br><br>
<button type="button" id="answer">Answer</button><br><br> Result:
<input type="text" id="result">
</div>
</body>
</html>
On By
Navya