Descending Order using While Loop in Python


This program uses a while loop to iterate through the numbers 10 down to 1 (inclusive). The variable "i" is initialized to 10, and the while loop continues to execute as long as the value of "i" is greater than or equal to 1. Within the loop, the current value of "i" is printed, and then "i" is decremented by 1 using the statement "i = i-1". After all iterations are completed, the loop will exit and the program will end.

Source Code

i=10
while(i>=1):
   print(i)
   i=i-1
To download raw file Click Here

Output

10
9
8
7
6
5
4
3
2
1