Ascending Order using While Loop in Python


The program uses a while loop to print the numbers 1 through 10. The variable "i" is initialized to 1 before the start of the loop, and the condition "i <= 10" is used to determine when the loop should end. Within the loop, the current value of "i" is printed, and then the value of "i" is incremented by 1 using the statement "i + 1". The loop will continue to execute as long as the condition "i <= 10" is true, so it will print the numbers 1 through 10 before ending.

Source Code

i=1
while(i<=10):
   print(i)
   i+1
To download raw file Click Here

Output

1
2
3
4
5
6
7
8
9
10