Python Program - Display the multiplication Table
www.igieditfa.com
Here's a Python program to display the multiplication table of a given number:
def multiplication_table(num): for i in range(1, 11): print(num, 'x', i, '=', num*i) num = int(input('Enter a number: ')) multiplication_table(num)
In this program, the function multiplication_table
takes a number as an argument and prints the multiplication table of that number from 1 to 10 using a for
loop. The user is prompted to enter a number and the function is called with that number as an argument. The output shows the multiplication table of the entered number.
Here's an example output of the program when the user enters 5:
Enter a number: 5 5 x 1 = 5 5 x 2 = 10 5 x 3 = 15 5 x 4 = 20 5 x 5 = 25 5 x 6 = 30 5 x 7 = 35 5 x 8 = 40 5 x 9 = 45 5 x 10 = 50