Computer Science, asked by shahnashahnawaz15, 5 months ago

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

Answers

Answered by anindyaadhikari13
3

Question:-

  • Write a Python program for the following pattern.

Program:-

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

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

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

if(i==j):

print("1",end=" ")

else:

print("0", end=" ")

print()

Answered by aryahikaul501
0

Answer:

Program:-

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

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

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

if(i==j):

print("1",end=" ")

else:

print("0", end=" ")

print()

Explanation:

Mark me as brainliest

Similar questions