Program to print table
In this section, you will learn how you can easily print table like : "5", "10", "12", "25", "100" and more. In this example, we print table of 5 using javascript.
Let's try to create a simple program :
➤ Code : JavaScript program to print table for a given number;
<script>
//Enter your number here, as often as you want to print table.
var number = 5;
for(let i = 1; i<=10; i++) {
let table = number * i;
console.log(number+"*"+i+"= "+table);
}
<script>
Output :
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25
5 * 6 = 30
5 * 7 = 35
5 * 8 = 40
5 * 9 = 45
5 * 10 = 50
Comments