#C11427. Find Palindromic Numbers
Find Palindromic Numbers
Find Palindromic Numbers
Given a positive integer \(n\), your task is to find and output all palindromic numbers in the range \([1, n]\). A palindromic number is a number that remains the same when its digits are reversed. For example, \(121\) is a palindrome, while \(123\) is not. If \(n = 0\), no numbers should be output.
Constraints: \(1 \le n \le 10^6\).
inputFormat
Input consists of a single integer (n) (read from standard input), which represents the upper bound of the range (inclusive).
outputFormat
Output all palindromic numbers from 1 to (n) separated by a single space to standard output. If no palindromes exist (for example, when (n = 0)), output nothing.## sample
10
1 2 3 4 5 6 7 8 9