Python Program to Print Multiplication Numbers in Right Triangle

In this Python program, you will learn to print the multiplication numbers in a right angled triangle rows pattern using for loop, while loop, and functions.

The below example accepts the user-entered rows, and the nested for loop iterates the rows and columns. Next, the program will print the right angled triangle of multiplication numbers on each row.

rows = int(input("Enter Rows = "))

for i in range(1, rows + 1):
for j in range(1, i + 1):
print(i * j, end=' ')
print()
Enter Rows = 7
1 
2 4 
3 6 9 
4 8 12 16 
5 10 15 20 25 
6 12 18 24 30 36 
7 14 21 28 35 42 49 

Instead of a Python for loop syntax, this Python program uses a Python while loop to iterate the rows and columns and prints the multiplication numbers in a right angled triangle pattern.

rows = int(input("Enter Rows = "))

i = 1
while i <= rows:
j = 1
while j <= i:
print(i * j, end=' ')
j += 1
print()
i += 1
Enter Rows = 8
1 
2 4 
3 6 9 
4 8 12 16 
5 10 15 20 25 
6 12 18 24 30 36 
7 14 21 28 35 42 49 
8 16 24 32 40 48 56 64 

In this Python program, we have created a MultiplicationNumbersRightTriangle function that accepts rows as the parameter value. Next, it uses the nested for loops to print the right angled triangle of multiplication numbers on each rows. For more patterns, please refer to the Python Number pattern programs.

def MultiplicationNumbersRightTriangle(rows):
for i in range(1, rows + 1):
for j in range(1, i + 1):
print(i * j, end=' ')
print()


n = int(input("Enter Rows = "))
MultiplicationNumbersRightTriangle(n)
Python Program to Print Multiplication Numbers in Right Triangle

Also Read