Printing pattern of 54321 5432 543 54 5 using python
Answers
Answered by
9
Logic for 54321 5432 543 54 5 pattern.
User input - N:
for(i=1; i<=N; i++)
{
for(j=N; j>i; j--)
{
print j value;
}
print new line;
}
This logic will prints the pattern of
5 4 3 2 1
5 4 3 2
5 4 3
5 4
5
User input - N:
for(i=1; i<=N; i++)
{
for(j=N; j>i; j--)
{
print j value;
}
print new line;
}
This logic will prints the pattern of
5 4 3 2 1
5 4 3 2
5 4 3
5 4
5
Answered by
7
Answer:
Explanation:
n=int(input("enter the number: "))
for i in range(n,0,-1):
for j in range(i,0,-1)
print(j,end=" ")
print()
output:-
enter the number:- 5
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1
Similar questions