π Day 37/150 – Multiplication Table in Python
A multiplication table shows the result of multiplying a number with a series of numbers.
Example for 5:
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
Let’s explore different ways to print multiplication table in Python π
πΉ Method 1 – Using for Loop
n = 5 for i in range(1, 11): print(n, "x", i, "=", n * i)
✅ Most common and easiest method.
πΉ Method 2 – Taking User Input
n = int(input("Enter a number: ")) for i in range(1, 11): print(n, "x", i, "=", n * i)
✅ Useful for dynamic tables.
.png)

0 Comments:
Post a Comment