数组
** xdoj–回文数**
#includeint main() { int n, i, sum = 0; scanf("%d",&n); int a[10] = {0}; for(i=0;n!=0;i++) { a[i]=n%10; sum += a[i]; n /= 10; } int t = i; for(i=0;i<=t/2;i++) { if(a[i] != a[t-1-i]) { printf("no"); break; } } if(i==1+t/2) printf("%d",sum); return 0; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)