标签:hide color case closed basic ice isp click inf
读入一个正整数 n,计算其各位数字之和,用汉语拼音写出和的每一位数字。
1 #include<stdio.h> 2 int main(){ 3 char c; 4 int sumt=0,t[10],count,i; 5 scanf("%c",&c); 6 while(c!=‘\0‘&&c!=‘\n‘){ 7 sumt += (c-‘0‘); 8 scanf("%c",&c); 9 } 10 count = 0; 11 while(sumt!=0){ 12 i = sumt%10; 13 t[count++] = i; 14 sumt = sumt / 10; 15 } 16 for(i=count-1;i>=0;i--){ 17 switch(t[i]){ 18 case 0:{printf("ling");break;} 19 case 1:{printf("yi");break;} 20 case 2:{printf("er");break;} 21 case 3:{printf("san");break;} 22 case 4:{printf("si");break;} 23 case 5:{printf("wu");break;} 24 case 6:{printf("liu");break;} 25 case 7:{printf("qi");break;} 26 case 8:{printf("ba");break;} 27 case 9:{printf("jiu");break;} 28 } 29 if(i!=0) printf(" "); 30 } 31 32 }
关于int 中最大的数:
PAT (Basic Level) Practice (中文) 1002 写出这个数
标签:hide color case closed basic ice isp click inf
原文地址:https://www.cnblogs.com/Learn-Excel/p/12652084.html