Write a Python Program to Print Multiplication Table using For Loop, and While Loop with example.
Python Program to Print Multiplication Table using For loop
This Python program will print multiplication table from 8 to 10 using For Loop
# Python Program to Print Multiplication Table print(" Multiplication Table ") for i in range(8, 10): for j in range(1, 11): print('{0} * {1} = {2}'.format(i, j, i*j)) print('==============')
OUTPUT
Python Program to Print Multiplication Table Example 2
This program allows user to enter any integer value. Next, it will print multiplication table from user entered value to 10
# Python Program to Print Multiplication Table num = int(input(" Please Enter any Positive Integer lessthan 10 : ")) print(" Multiplication Table ") for i in range(num, 10): for j in range(1, 11): print('{0} * {1} = {2}'.format(i, j, i*j)) print('==============')
OUTPUT
Python Program to display Multiplication Table using While loop
This program is same as above but this time we are using While Loop
# Python Program to display Multiplication Table i = int(input(" Please Enter any Positive Integer lessthan 10 : ")) print(" Multiplication Table ") while(i <= 10): j = 1 while(j <= 10): print('{0} * {1} = {2}'.format(i, j, i*j)) j = j + 1 print('==============') i = i + 1
OUTPUT