Multiplication Table using While Loop in Python


This program is a simple program that generates a multiplication table for a given number (table) within a specified range (start and limit). The program first prompts the user to input the number for which they want to generate the table, the starting number of the range, and the ending number of the range. It then uses a while loop to iterate through the range of numbers from the starting number to the ending number (inclusive), and for each iteration, it calculates the product of the current number and the input table number and prints it out in the format "current number * table number = product". The loop continues until the current number is equal to or greater than the limit.

Source Code

table   =int(input("Enter the table :"))
start   =int(input("Enter the starting number : "))
limit   =int(input("Enter the limit :"))
while(start<=limit):
  print(start,"*",table,"=",start*table)
  start=start+1
To download raw file Click Here

Output

Enter the table :5
Enter the starting number : 1
Enter the limit :10
1 * 5 = 5
2 * 5 = 10
3 * 5 = 15
4 * 5 = 20
5 * 5 = 25
6 * 5 = 30
7 * 5 = 35
8 * 5 = 40
9 * 5 = 45
10 * 5 = 50


Reverse Multiplication Table

This program is a Python program to print the multiplication table of a given number up to a given limit.

The program starts by taking three inputs:

  • table: the number for which the multiplication table is to be printed
  • start: the starting number for the table (from where the table starts)
  • limit: the limit till which the table is to be printed

After taking the inputs, the program enters a while loop. The loop continues until limit is greater than or equal to start. For each iteration of the loop, the program calculates the product of limit and table and prints the result along with the values of limit and table. After each iteration, limit is decremented by 1.

Finally, when limit is less than start, the loop terminates and the program ends.

Source Code

table   =int(input("Enter the table :"))
start   =int(input("Enter the starting number : "))
limit   =int(input("Enter the limit :"))
while(limit>=start):
   print(limit,"*",table,"=",limit*table)
   limit=limit-1
To download raw file Click Here

Output

Enter the table :5
Enter the starting number : 1
Enter the limit :10
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