In this program, we are going to see how we can print the multiplication table of any user given input number.

Logic

Printing multiplication table of any number is quite simple and an easy task. After taking input (num) from the user we have to start one loop from 1 to 10, and then inside the loop simply multiply num by current number “i” and print it.

Program

# Take input from user
num = int(input("Enter number to print table : "))

print("\nTable of", num)

# Printing table of given number
for i in range(1, 11):
    print(num, "*", i, "=", (num * i))

Output

Enter number to print table : 2
2 * 1 = 2
2 * 2 = 4
2 * 3 = 6
2 * 4 = 8
2 * 5 = 10
2 * 6 = 12
2 * 7 = 14
2 * 8 = 16
2 * 9 = 18
2 * 10 = 20