Exercise 12
1) - Write a program in Python that asks the user to enter an integer n and display the multiplication table of this number.
2) - Improve the program so that it displays multiplication tables of all numbers between 1 and 9
Solution
Question1
# Ask to type a value of the integer n n = int(input("Type a value of the integer n ")) print("The multiplication table of : ", n," is :") for i in range(1,10): print(i , " x ", n, " = ",i*n)
Question2
for n in range(1,10): #insert separator print("--------------------------------------") print("The multiplication table of : ", n," is :") for i in range(1,10): print(i , " x ", n, " = ",i*n)
Younes Derfoufi