Write a Python program to print the table of number using for 'loopc and 'while' loop separately.
Answers
Answered by
0
Answer:
Answer
Explanation:
In the program, user is asked to enter the number and the program prints the multiplication table of the input number using for loop. The loops run from 1 to 10 and the input number is multiplied by the loop counter in each step to display the steps of multiplication table.
# Program published on https://beginnersbook.com
# Python Program to Print Multiplication Table of a Number
num = int(input("Enter the number: "))
print("Multiplication Table of", num)
for i in range(1, 11):
print(num,"X",i,"=",num * i)
Output:
Enter the number: 6
Multiplication Table of 6
6 X 1 = 6
6 X 2 = 12
6 X 3 = 18
6 X 4 = 24
6 X 5 = 30
6 X 6 = 36
6 X 7 = 42
6 X 8 = 48
6 X 9 = 54
6 X 10 = 60
Similar questions