#include<stdio.h>
#include<string.h>
int main(void)
{
char ch[100];
char chn[10][5]={"ling","yi","er","san","si","wu","liu ","qi","ba","jiu"};
int i=0;
int sum=0;
int cnt=1;
int t,a;
scanf("%s",&ch);
for(i=0;i<strlen(ch);i++)
{
sum+=ch[i]-'0';//从字符型数字向整型 数字转变的方法
}
t=sum;
while(t>9){
t=t/10;
cnt*=10;
}
while(sum>0){
a=sum/cnt;
sum=sum%cnt;
cnt/=10;
printf("%s",chn[a]);
if(cnt>=1){
printf(" ");
}
}
return 0;
}
PAT+乙1002. 写出这个数
最新推荐文章于 2021-06-21 22:32:31 发布