Basic Programs

If Else Programs

While loop Programs

For loop Programs

List Programs


Python Program to Print a Multiplication Table using While Loop


This example shows, how to print the multiplication table using while loop in python.

Steps
  1. Get the input from user (t) for which the multiplication table is to be generated.
  2. Get the input from user (n) for the multiplication table.
  3. The loop starts at i = 1 and continues until i exceeds n.
  4. In each iteration of the loop, the current multiplication result (i * t) is calculated and printed.
  5. The counter i is incremented after each iteration to move to the next step of the multiplication table.
Example :
Example.py
i=1
t=int(input("Enter table no: "))
n=int(input("Enter limit: "))
while(i<=n):
    print(t,"*",i,"=",i*t)
    i+=1 

Output

Enter table no: 10
Enter limit: 10
10 * 1 = 10
10 * 2 = 20
10 * 3 = 30
10 * 4 = 40
10 * 5 = 50
10 * 6 = 60
10 * 7 = 70
10 * 8 = 80
10 * 9 = 90
10 * 10 = 100

Prev Next