online_judge_1106

#include <stdio.h>
#include <stdlib.h>
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;
}

posted on 2015-01-28 16:47  赛亚人  阅读(103)  评论(0编辑  收藏  举报