1723 - 中级第五课——找回文数1
找出10000以内的回文数。
从左向右读与从右向左读是同一个数的数为回文数,如19391是回文数。
<br />
Input
无
Output
输出所有符合条件的回文数,
Examples
Input
Output
Solution C++
#include <cmath> #include <iostream> using namespace std; int main() { int a,b,c,d; for(a=2;a<10000;a++){ b=a; d=0; while(b>0){ c=b%10; d=d*10+c; b=b/10; } if(a==d){ cout<<a<<' '; } } cout<<endl; return 0; }