Computer Science, asked by shahnashahnawaz15, 4 months ago

Write a python program for
1
0 1
0 0 1
0 0 0 1
0 0 0 0 1​

Answers

Answered by anindyaadhikari13
2

Question:-

Write a Python program to display the pattern.

1

0 1

0 0 1

0 0 0 1

0 0 0 0 1

Program:-

n=int(input("Enter the number of rows: "))

for i in range(1,n+1):

for j in range(1,i+1):

if(i==j):

print("1",end=" ")

else:

print("0", end=" ")

print()

Similar questions