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