Write a JavaScript program to print the multiplication table of a number

Description: Print the multiplication table of 7, from 1 to 10.

Hint:

  • Use a for loop from 1 to 10.

JavaScript multiplication table program

const num = 7;

for (let i = 1; i <= 10; i++) {
  console.log(`${num} x ${i} = ${num * i}`);
}

Output:

Tutorials Class - Output Window

7 x 1 = 7
7 x 2 = 14
7 x 3 = 21
7 x 4 = 28
7 x 5 = 35
7 x 6 = 42
7 x 7 = 49
7 x 8 = 56
7 x 9 = 63
7 x 10 = 70

How it works

  • The loop runs with i from 1 to 10.
  • The template literal prints the line with the numbers.

Read JavaScript Loops.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.