Python Program to Print Multiplication Table Of Given Number


This program prints or generates multiplication table of a given number in Python language.

In this Python program, we first read number from user. Then we print multiplication table of that number using for loop.

Python Source Code: Multiplication Table of Number


# Multiplication Table of a number

number = int(input("Enter number: "))

print("\nMultiplication table of %d is:\n" %(number))
for i in range(10):
    print("%-5d X %5d = %5d" % (i, number, i*number))

Output

Enter number: 9

Multiplication table of 9 is:

0     X     9 =     0
1     X     9 =     9
2     X     9 =    18
3     X     9 =    27
4     X     9 =    36
5     X     9 =    45
6     X     9 =    54
7     X     9 =    63
8     X     9 =    72
9     X     9 =    81