Multiplication Table Program using for loop
1 2 3 4 5 |
GivenNumber= int(input ("Please Enter the number for which the user wants to print the multiplication table: ")) # Here, The "for loop" will run to iterate the multiplication 20 times print ("The Multiplication Table of: ", GivenNumber) for counting in range(1, 21): print (GivenNumber, 'x', counting, '=', GivenNumber * counting) |
Multiplication Table Program using while loop
1 2 3 4 5 6 |
Number=int(input("Please enter the desired number")) Limit=int(input("Please Enter the maximum range number to which you want to print table")) LoopVariable=1 while LoopVariable<=Limit: print(Number,"x",LoopVariable,"=",Number*LoopVariable) LoopVariable=LoopVariable+1 |