题解 | #回文对称数#
回文对称数
https://www.nowcoder.com/practice/5b143af8328f4e42adf5e10397ae44ef
int main() { int n = 0; int arr[5] = { 0 }; scanf("%d", &n); int num = 1; while (num <= n) { int sum = 0; int m = num; int i = 0; while (m) { arr[i++] = m % 10; m /= 10; } i--; for (int j = 0; j <= i;j++) { sum = arr[j] + sum * 10; } if (sum == num) { printf("%d ", sum); } num++; } return 0; }