Write a python program to print given triangle. - Pratik Ghelani

Pratik Ghelani

Breaking

Sunday, May 10, 2020

Write a python program to print given triangle.

Input:-

n = int(input("Enter the Number of Rows:"))
for row in range(n):
    for col in range(n):
        if col==0 or row==(n-1) or row==col:
            print("*",end="")
        else:
            print(end=" ")

    print()

Output:-

No comments:

Post a Comment