FLOYD'S triangle python program using WHILE LOOP

Tech Programmer
0

WRITE A PYTHON PROGRAM TO PRINT FLOYD'S TRIANGLE USING WHILE LOOP


NOTE :  A Floyd's triangle is a right-angled triangle formed with natural numbers.


CODE FOR THE ABOVE  PYTHON  PROGRAM :


print("Enter the length of the triangle : "end="")
len = int(input())

num = 1
i = 0
while i < len:
    j = 0
    while j < i+1:
        print(numend=" ")
        num = num+1
        j = j+1
    print()
    i = i+1


WRITTEN CODE FOR THE ABOVE PROGRAM :


print("Enter the length of the triangle : ", end="")

len = int(input())


num = 1

i = 0

while i < len:

    j = 0

    while j < i+1:

        print(num, end=" ")

        num = num+1

        j = j+1

    print()

    i = i+1


OUTPUT :





Post a Comment

0Comments
Post a Comment (0)

Featured Highlighted Categories

You'll discover all of the most up-to-date bring innovative here.

Python List theory with List Programs
Get complete python lists theory and list basic and insane programs for your practice.
CBSE SAMPLE PAPERS
Get CBSE sample and question papers of last 7 years with answers to get best practice for your Board Exams
Python String theory and String Programs
Python strings complete theory with illustrations and practice programs for free