Hey guys, in this blog we will see a Python Program to Display the multiplication Table by simply using the for-loop.
Code
# Multiplication table (from 1 to 10) in Python # To take input from the user num = int(input("Display multiplication table of? ")) # Iterate 10 times from i = 1 to 10 for i in range(1, 11): print(num, 'x', i, '=', num*i)
Output
Display multiplication table of? 1 1 x 1 = 1 1 x 2 = 2 1 x 3 = 3 1 x 4 = 4 1 x 5 = 5 1 x 6 = 6 1 x 7 = 7 1 x 8 = 8 1 x 9 = 9 1 x 10 = 10
Display multiplication table of? 10 10 x 1 = 10 10 x 2 = 20 10 x 3 = 30 10 x 4 = 40 10 x 5 = 50 10 x 6 = 60 10 x 7 = 70 10 x 8 = 80 10 x 9 = 90 10 x 10 = 100
Display multiplication table of? 99 99 x 1 = 99 99 x 2 = 198 99 x 3 = 297 99 x 4 = 396 99 x 5 = 495 99 x 6 = 594 99 x 7 = 693 99 x 8 = 792 99 x 9 = 891 99 x 10 = 990
This is a very simple program that uses for-loops to print the table of any number input by the user.
Check out our other python programming examples…