# 1002 写出这个数 (20 分)

### 输入样例：

1234567890987654321123456789


### 输出样例：

yi san wu


#include<cstdio>
#include<cstring>
int main()
{
char str[101];
char p[10][5] = {"ling","yi","er","san","si","wu","liu","qi","ba","jiu"};
int len,sum=0,i,m=0;
int n[50];

scanf("%s",str);
len = strlen(str);
for(i=0; i<len; i++)	{
sum+=(str[i] - '0');
}

do	{
n[m++] = sum%10;							//m是数组下标
sum = sum/10;
}	while(sum>0);
int count=0;
for(i=m-1; i>=0; i--)	{
if(count != 0)	printf(" "); count++;
if(n[i] == 0)	printf("%s",p[0]);
else if(n[i] == 1) printf("%s",p[1]);
else if(n[i] == 2) printf("%s",p[2]);
else if(n[i] == 3) printf("%s",p[3]);
else if(n[i] == 4) printf("%s",p[4]);
else if(n[i] == 5) printf("%s",p[5]);
else if(n[i] == 6) printf("%s",p[6]);
else if(n[i] == 7) printf("%s",p[7]);
else if(n[i] == 8) printf("%s",p[8]);
else if(n[i] == 9) printf("%s",p[9]);
}

return 0;

} 

01-02 2520
07-14 254

03-10 2643
04-06 1097
03-26 2万+
05-26 659
08-04 103
03-17 665
01-01 1850
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客