Displays the multiplication table of a number:
num = int(input("Enter a number: ")) # Display multiplication table print(f"Multiplication table of {num}:") for i in range(1, 11): print(f"{num} x {i} = {num*i}") In this program, we first take an input number from the user. Then, we use a `for` loop to iterate through the range 1 to 10. Inside the loop, we multiply the number by each integer from 1 to 10 and display the multiplication table in the format "number x i = result".
Comments
Post a Comment