Python While loop 2

Example: print all multiples of 5 upto 100
Sol:

i=5
while(i<=100):
    print(i)
    i=i+5

Output:

5
10
15
20
25
30
35
40
45
50
55
60
65
70
75
80
85
90
95
100
>>>

Example: print all multiples of 7 upto 70
Sol:

i=7
while(i<=70):
    print(i)
    i=i+7

Output:

7
14
21
28
35
42
49
56
63
70
>>>

Example: Write a python script to take input for a limit , print all the numbers upto the limit?
Sol:

n=int(input("Enter the limit "))
i=1
while(i<=n):
    print(i)
    i=i+1

Output:

Enter the limit 12
1
2
3
4
5
6
7
8
9
10
11
12
>>>

Example: Write a python script to take input for a limit , print all the numbers upto the limit in reverse order?
Sol:

n=int(input("Enter the limit "))
i=n
while(i>=1):
    print(i)
    i=i-1

Output:

Enter the limit 15
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
>>>

Visitor Counter

0183296