CBSE Class 10 Computer Applications Question 26 of 26

Python Conditionals and Loops — Question 17

Back to all questions
17
Question

Question 13

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

Answer
Solution
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