#include<cstdio>
using namespace std;
int reverse(int n){
//名为reverse的函数,有一个int参数,返回值是int类型
int remain ;
int reverse = 0;
while(n > 0){
remain = n%10;
n = n/10;
reverse = reverse*10 + remain;
//当最后一次循环执行完以后,退出循环
if(n == 0){
break;
}
}
return reverse;
}
int main(){
int a,b,c,d;
for(a = 1; a <= 9; ++a){
for(b = 0; b <= 9; ++b){
for(c = 0; c <= 9; ++c){
for(d = 0; d <= 9; ++d){
int n = 1000*a+100*b+10*c+d;
if(n*9 == reverse(n)){
printf("%d\n",n);
}
}
}
}
}
}

京公网安备 11010502036488号