Programming Example

WAP to print first n odd numbers in descending order.

Solution

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


CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Website development Company in Allahabad