Tuesday, 6 February 2024

Class 11 CS Practical - 13

 

13 - Write a program in Python to generate the following pattern using nested loops:

5

54

543

5432

54321


for i in range(5,0,-1):

    for j in range(5,i-1,-1):

        print(j,end='')

    print()


Output:

5

54

543

5432

54321


No comments:

Post a Comment