Coding | Mcqs | Multiple choice questions | Informative | Computer Science | Engineering | Aptitude | Quants | Verbal

INFEED

power pattern

 x=int(input())
c=1
for i in range(x-1):
    for j in range(x-1):
        if(i==j):
            print(c,end='')
            c+=1
        else:
            print(' ',end='')
    print()
s=''
for i in range(x):
    s+=str(c)
    c+=1
print(s[::-1])
for i in range(x-1):
    for j in range(x-1):
        if(i==j):
            print('',c,end='')
            c+=1
        else:
            print(' ',end='')
    print()

Post a Comment

Previous Post Next Post