Mastering Multiplication: Generate Any Multiplication Table with Python

Here's a program that allows you to generate a multiplication table for any number:

python
num = int(input("Enter a number to generate its multiplication table: ")) print("Multiplication Table for", num) for i in range(1, 11): result = num * i print(num, "x", i, "=", result)

In this program, the user is prompted to enter a number for which they want to generate the multiplication table. The program then iterates from 1 to 10 and calculates the product of the entered number with each iteration variable. The result is printed as an equation in the format "number x iteration = product".

For example, if you enter 5, the program will output the following multiplication table:

css
Multiplication Table for 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

Feel free to try different numbers and generate multiplication tables as needed. Let me know if you have any further questions!

Comments