A Program to Display Multiplication Table

In this example, we are giving a program to display the multiplication table of a given number.


Program to display multiplication table:

  1. # Display multiplication table
  2. num = int(input('Enter a number: '))
  3. for i in range(1, 11):
  4. print(num, 'x', i, "=", num*i)

Output:

Enter a number: 7
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