Multiplication Table using While Loop in Python


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

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