KnowledgeBoat Logo

Computer Science

Write a short program to print first n odd numbers in descending order.

Python

Python Control Flow

78 Likes

Answer

n = int(input("Enter n: "))
x = n * 2 - 1

for i in range(x, 0, -2) :
    print(i)

Output

Enter n: 5
9
7
5
3
1

Answered By

35 Likes


Related Questions