Python program to print first and odd numbers in descending order


Write a program in python to print first and odd numbers in descending order

----------------------------------

num=int(input("Enter the Limit : "))
if num%2==0:
    for i in range(num-1,0,-2):
        print(i)
else:
    for i in range(num,0,-2):
        print(i)

----------------------------------

Output :-

Enter the Limit : 50

49

47

45

43

41

39

37

35

33

31

29

27

25

23

21

19

17

15

13

11

9

7

5

3

1

Post a Comment

0 Comments