#include <cstdio> int main() { int s=0; for(int i=100;i<1000;i++) {int a,b,c; b=i/10%10; c=i%10; if(i%10==i/100) { printf("回文数:%d;\n",i); s++; } } printf("三位回文数总共 %d 个。\n",s); return 0; }
试验代码 c++:https://c.runoob.com/compile/12