该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include
#include
int main(void)
{
char s[100];
int a[100];
int sum, cnt, flag;
while( gets(s) != NULL ){
sum = 0;
flag = 0;
for( cnt = 0; cnt <= strlen(s) - 1; cnt++ ){
sum += s[cnt] - 48;
}
if( sum == 0 ){
a[0] = 0;
cnt = 1;
}
for( cnt = 0; sum > 0; cnt++ ){
a[cnt] = sum % 10;
sum /= 10;
}
cnt--;
for( ; cnt >= 0; cnt--){
if( flag ){
printf(" ");
}
switch( a[cnt] ){
case 0: printf("ling"); break;
case 1: printf("yi"); break;
case 2: printf("er"); break;
case 3: printf("san"); break;
case 4: printf("si"); break;
case 5: printf("wu"); break;
case 6: printf("liu"); break;
case 7: printf("qi"); break;
case 8: printf("ba"); break;
case 9: printf("jiu"); break;
}
flag = 1;
}
printf("\n");
}
return 0;
}