#include#include int shuhe(int n){ int sum=0; while(n) { sum+=n%10; n/=10; } return sum;}int main(){ int n=1; while(n!=0) { scanf("%d",&n); if(n<=0||n>=40000) continue; printf("%d %d\n",shuhe(n),shuhe(n*n)); } return 0;}
本文共 380 字,大约阅读时间需要 1 分钟。
#include#include int shuhe(int n){ int sum=0; while(n) { sum+=n%10; n/=10; } return sum;}int main(){ int n=1; while(n!=0) { scanf("%d",&n); if(n<=0||n>=40000) continue; printf("%d %d\n",shuhe(n),shuhe(n*n)); } return 0;}
转载于:https://www.cnblogs.com/abc-24990/p/4257455.html