PAT乙级1002第二个测试点错误,求大佬解答

#include 
#include 

void pinyin(int a){
	switch(a){
		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;
    }
}

int main(){
    char n[100];
    int sum=0,i,a,b,c;
    scanf("%s",&n);
    for(i=0;i<strlen(n);i++)sum+=n[i]-'0';
    a=sum/100;
    b=sum/10%10;
    c=sum%10;
    if(a){
    	pinyin(a);
    	printf(" ");
	}
	if(b){
    	pinyin(b);
    	printf(" ");
	}
	pinyin(c);
    return 0;
}

你可能感兴趣的:(PAT乙级1002第二个测试点错误,求大佬解答)