Floyd’s triangle is a right-angled triangular array of natural numbers as shown below:

Floyd’s triangle is a right-angled triangular array of natural numbers as shown below:

https://javaconceptoftheday.com/wp-content/uploads/2015/12/FloydTriangle.png

Write a program to print the Floy’d triangle.

# Floyd's Triangle

row = int(input("Rows you want  : "))

num = 1

print("Floyd's Triangle")
for i in range(1, row + 1):
    for j in range(1, i + 1):
        print(num, end = '  ')
        num= num + 1
    print()

Related Articles

Responses

Your email address will not be published. Required fields are marked *