Python
# Program to print odd numbers up to N
n = int(input("Enter upper limit: "))
for i in range(1, n + 1, 2):
print(i)Output
Enter upper limit: 10 1 3 5 7 9
We start from 1 and step by 2 with range(1, n + 1, 2) to generate all odd numbers <= n.