Logic Building
# Take n as input
n = int(input("Enter a number: "))
# Print multiplication table
print(f"Multiplication table of {n}:")
for i in range(1, 11):
result = n * i
print(f"{n} × {i} = {result}")Output
Enter a number: 5 Multiplication table of 5: 5 × 1 = 5 5 × 2 = 10 5 × 3 = 15 ... 5 × 10 = 50
Loop from 1 to 10, multiply n by each.
Key Concepts:
- Loop variable i from 1 to 10
- Calculate n * i for each iteration
- Print formatted result