1447 - 统计4位的回文数
题目描述
回文数指的是正过来读和反过来读都是一样的数,比如 1661 、 2772 都是回文数,请你编程找出所有的 4 位的回文数。
输入
无
输出
由小到大输出所有的 4位回文数,每行 1个。
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x,j;
for(int i=1000;i<=9999;i++)
{ j=i;
x=0;
while(j!=0)
{
x=x*10+j%10;
j=j/10;
}
if(i==x)
{
cout<<i<<endl;
}
}
return 0;
}