Site icon Codeforcoding

Python program to display the multiplication table

Python program to display the multiplication table

In this tutorial, we will discuss the concept of Python program to display the multiplication table.

We will learn how to create a multiplication table in a various way in Python language

Program 1

Program to print the multiplication table using for loop in Python

'''multiplication table in Python'''
num=input("Enter the number for multiplication table: ");
#get input from user

#use for loop to iterates 1 times
for i in range(1,11):
    print(num,'x',i,'=',num*i)  #for display multiplication table

When the above code is executed, it produces the following results:

Enter the number for multiplication table:  
12
12x1=12
12x2=24
12x3=36
12x4=48
12x5=60
12x6=72
12x7=84
12x8=96
12x9=108
12x10=112

 

Program to print the multiplication table using while loop in Python

Program 1

num=input("Enter the number for multiplication table: \n");
#get input from user
i=0;
while i<=num:  #use for loop to iterates 1 times
    i+=1;
    print(num,'x',i,'=',num*i)

When the above code is executed, it produces the following results:

Enter the number for multiplication table:
12
12x1=12
12x2=24
12x3=36
12x4=48
12x5=60
12x6=72
12x7=84
12x8=96
12x9=108
12x10=120
12x11=132
12x12=144
12x13=156

 

Similar post

Python program to display the multiplication table

Java program to display the multiplication table

Cpp program to print multiplication table

C program to display multiplication table

Java program to display the multiplication table using array

 

Suggested for you

Loops in Java language

Loops in C language

Loops in C++ language

 

For loop in C++ language

For loop in Java language

For loop in C language

For loop in Python language

 

While loop in Java language

While loop in C language

While loop in C++ language

While loop in Python language

 

Nested for loop in Java language

Nested for loop in C++ language

Nested for loop in C language

Nested for loop in Python language

 

If statements in Java  language

Nested if statements in Java  language

 

you may also like this

Floyd’s triangle number pattern using for loop in C

Floyd’s triangle pattern using nested for loop in Java

Floyd’s triangle pattern using nested while loop in Java

Hollow pyramid triangle pattern in C++ language

Pyramid star pattern in Cpp

Pyramid star pattern in C

Pyramid star pattern in Java 

 

 

 

Cpp program to multiplication table
Java program to multiply two numbers
Exit mobile version