Reverse Multiplication Table Using For loop in Python
Last Updated :
23 Feb, 2024
A multiplication table of any number can be printed using the For loop in Python. We can also print the multiplication table in reverse order using a for loop in Python. In this article, we will see how we can print the multiplication table in reverse order using a for loop in Python.
Example:
Input: TableNumber = 2
Output:
Printing Multiplication Table of 2 in reverse order
10 * 2 = 20
9 * 2 = 18
8 * 2 = 16
7 * 2 = 14
6 * 2 = 12
5 * 2 = 10
4 * 2 = 8
3 * 2 = 6
2 * 2 = 4
1 * 2 = 2
Reverse Multiplication Table Using For loop in Python
Below are some of the ways by which we can print the multiplication table in reverse order using for loop in Python:
Reverse Multiplication Table by Getting User-Defined Multiplier
In this example, the code first prompts the user for a number, then prints its multiplication table in reverse order, starting from 10 down to 1.
Python3
print ( "Enter the number of multiplication table to print:" )
tableNumber = int ( input ())
print ( "Printing Multiplication Table of" , tableNumber, "in Reverse Order" )
for num in range ( 10 , 0 , - 1 ):
print (num, "*" , tableNumber, " =" , (num * tableNumber))
|
Output:
Enter the Number of Multiplication Table to Print:
5
Printing Multiplication Table of 5 in Reverse Order:
10 * 5 = 50
9 * 5 = 45
8 * 5 = 40
7 * 5 = 35
6 * 5 = 30
5 * 5 = 25
4 * 5 = 20
3 * 5 = 15
2 * 5 = 10
1 * 5 = 5
Reverse Multiplication Table of Pre-defined Multiplier Number
In this example, the code generates the multiplication table of 2 in reverse order. It starts by setting the multiplier to 2, then uses a for loop to iterate through numbers from 10 down to 1. For each number, it multiplies it by the multiplier and prints the result, creating a descending table of multiplication facts for 2.
Python3
multiplier = 2
for num in range ( 10 , 0 , - 1 ):
print (num, "*" , multiplier, "=" , (num * multiplier))
|
Output:
10 * 2 = 20
9 * 2 = 18
8 * 2 = 16
7 * 2 = 14
6 * 2 = 12
5 * 2 = 10
4 * 2 = 8
3 * 2 = 6
2 * 2 = 4
1 * 2 = 2
Share your thoughts in the comments
Please Login to comment...