简单大数
#include<cstdio>
int digitroot(int d){
int sum,divide;
divide=1;
sum=0;
while(d/divide!=0){
sum+=(d/divide)%10;
divide*=10;
}
return sum;
}
int main(){
int d;
char bignum[1000];
int i=0;
while(scanf("%c",&bignum[i])&&bignum[i++]!='0'){
while(scanf("%c",&bignum[i])&&bignum[i++]!='\n');
i=0;
d=0;
while(bignum[i]!='\n') d+=bignum[i++]-'0';
while(d>9) d=digitroot(d);
printf("%d\n",d);
i=0;
}
return 0;
}