代码如下所示:
int main() { long wan, qian, bai, shi, ge,x; scanf_s("%d", &x); //取该数个,十,百,千,万位上的数字 wan = x / 10000; qian = x % 10000 / 1000; bai = x % 1000 / 100; shi = x % 100 / 10; ge = x % 10; if (wan == ge && qian == shi)//回文数的条件:万位和各位上的数字相同,十位和千位上的数字相同 printf("%lld is hui wenshu", x); else printf("%lld not is hui wen shu ",x); return 0; }
输出结果如下所示: