Write a program in Python to print the table of a number using ‘for’ loop.
Answers
Answered by
1
Program:
# Python program to print a multiplication table of
# a number inputted at runtime
# Ask the user to enter a number.
num = int(input("Enter number: "))
# Print the multiplication table of the provided number
# using a for loop
for x in range(1, 11):
print(num, "x", x, "=", num * x)
Explanation:
- We ask the user to input a number.
- When they input a number we assign it to variable num.
- Later, we for loop from 1 to 10 to get the divider.
- And print the number multiplied by the number provided by the for-loop.
Output is provided in the attachments!
Hope this helps you!
Attachments:
Answered by
1
Answer:
Hope this helped you if yes then pls mark me as brainliest.
Attachments:
Similar questions