Sunday, January 5, 2020

pyramid pattern

PYRAMID PATTERN USING FOR LOOP IN PYTHON LANGUAGE

-5 JANUARY 2020

CONCEPT:

The below program prints the pyramid pattern using * by for loop.

INPUT:

Enter the no of rows:4

PROGRAM:

num=int(input("Enter the no rows:"))
for i in range (0,num):
      for j in range(0, num-i-1):
           print (end=" ")
for j in range(0,i+1):
           print("*",end=" ")
print()

OUTPUT:

       

No comments:

Post a Comment