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
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 – Python Programs.
To practice all Python programs, here is complete set of 150+ Python Problems and Solutions.
Related Posts:
- Check Python Books
- Check Information Technology Books
- Apply for Python Internship
- Apply for Programming Internship
- Practice Programming MCQs