codescracker


python

Python Program to Print Multiplication Table



« Previous Program Next Program »


Print Multiplication Table in Python

To print multiplication table of any number in python, you have to first ask from user to enter the number and start calculating its table to print the multiplication table of the given number as shown in the program given below.

Python Programming Code to Print Multiplication Table

Following python program ask from user to enter a number and prints multiplication table of that number:

# Python Program - Print Multiplication Table of a Number

print("Enter 'x' for exit.");
num = input("Enter a number: ");
if num == 'x':
    exit();
else:
    number = int(num);
    for i in range(1, 11):
    	print(number, "*", i, "=", number*i);

Here is the sample run of the above python program to illustrates how to print multiplication table of any number:

print multiplication table python

Above is the sample initial output asking from user to enter that number whose multiplication table he/she want to print, say 2 and then press enter key to see the table as shown in the below screenshot of sample output:

print multiplication of number python

Here is the same program written and run on python shell:

python print multiplication table

Program Video with Compile and Run

Same Program in Other Languages

You may also like to learn or practice the same program in other popular programming languages:


« Previous Program Next Program »








Tools
Calculator

Quick Links
Signup - Login - Give Online Test