logo image

Factorial with HTML, javascript & jQuery

Views: 134

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>
We are looking for Interns!
Send your resumes to
[email protected]