Python Program to Print Table of a Given Number

This is a Python Program to print the table of a given number.

Problem Description

The program takes in a number and prints the table of a given number.

Problem Solution

1. Take in a number and store it in a variable.
2. Print the multiplication tables of a given number.
3. Exit.

Program/Source Code

Here is source code of the Python Program to print the table of a given number. The program output is also shown below.

 
n=int(input("Enter the number to print the tables for:"))
for i in range(1,11):
    print(n,"x",i,"=",n*i)
Program Explanation

1. User must enter a number.
2. Using a print statement, print the multiplication tables of the given number.

advertisement
Runtime Test Cases
 
Case 1:
Enter the number to print the tables for:7
7 x 1 = 7
7 x 2 = 14
7 x 3 = 21
7 x 4 = 28
7 x 5 = 35
7 x 6 = 42
7 x 7 = 49
7 x 8 = 56
7 x 9 = 63
7 x 10 = 70
 
Case 2:
Enter the number to print the tables for:17
17 x 1 = 17
17 x 2 = 34
17 x 3 = 51
17 x 4 = 68
17 x 5 = 85
17 x 6 = 102
17 x 7 = 119
17 x 8 = 136
17 x 9 = 153
17 x 10 = 170

Sanfoundry Global Education & Learning Series – 1000 Python Programs.

If you wish to look at all Python Programming examples, go to 1000 Python Programs.

📌 Limited Seats! Register Now - Free AI-ML Certification (January 2026)

👉 For weekly programming practice and certification updates, join Sanfoundry’s official WhatsApp & Telegram channels

advertisement
Manish Bhojasia – Founder & CTO at Sanfoundry

I’m Manish, Founder & CTO at Sanfoundry, with 25+ years of experience across Linux systems, SAN technologies, advanced C programming, and building large-scale, performance-driven learning and certification platforms focused on clear skill validation.

LinkedIn  ·  YouTube MasterClass  ·  Telegram Classes  ·  Career Guidance & Conversations