Design a JavaScript program to display the multiplication table by accepting the number and the limit.
<html>
<body>
<h1>Multiplication Table</h1>
Enter a number:
<input type="text" id="num" /><br /><br />
Enter limit:
<input type="text" id="limit" />
<input type="button" value="Find" onClick="multiply()" />
<p id="result"></p>
<script>
function multiply() {
var n = document.getElementById('num').value;
var l = document.getElementById('limit').value;
var out = "";
for (var i = 1; i < l; i++) {
out = out + i + " * " + n + " = " + i * n + "<br/>";
}
document.getElementById("result").innerHTML = out;
}
</script>
</body>
</html>
Output


This website really helps me to study for my exams
Thanks a lot !
Hey Arun, We are glad that you have enjoyed your learning experience with us.