*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * *
* * * * * * * * *
* * * * * * * * * *
Code - 1:
n=int(input("Enter the number of rows:"))
for j in range(1,n+1):
for i in range(1,j+1):
print("*",end=" ")
print()
Code - 2:
n=int(input("Enter the number of rows:"))
for i in range(1,n+1):
print("* "*i)
******************************************************
******************************************************
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8 9
n=int(input("Enter the number of rows: "))
for j in range(1,n+1):
for i in range(1,j+1):
print(i,end=" ")
print()
******************************************************
******************************************************
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
6 6 6 6 6 6
7 7 7 7 7 7 7
8 8 8 8 8 8 8 8
9 9 9 9 9 9 9 9 9
n=int(input("Enter the number of rows: "))
for j in range(1,n+1):
for i in range(1,j+1):
print(j,end=" ")
print()
No comments:
Post a Comment