首页 > 电脑

PAT甲1005,大佬帮忙看下哪里错了,看网大多使用输入字符串来解答。。。。

更新时间2018-03-06 19:38:15

#include <stdio.h>

#include <stdlib.h>

 

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

 

int main(int argc, char *argv[]) {

    long int N,temp,sum=0,counter=0;

char *S[10]={"zero","one","two","three","four","five","six","seven","eight","nine"};

scanf("%ld",&N);

while(N%10){

sum+=N%10;

N=N/10;

}

//printf("%ld",sum);

temp=sum;

while(temp=temp/10) counter++;

//printf("%d",counter);

 

    while(counter>0){

printf("%s ",S[sum/(counter*10)]);

sum=sum%(counter*10);

counter--;  

}

printf("%s ",S[sum]);

 

return 0;

}


PAT甲1005,大佬帮忙看下哪里错了,看网大多使用输入字符串来解答。。。。


你要把题目出处或详细的要求贴出来

单单程序没有要求是无法判断程序的正确性的

上一篇:解决问题

下一篇:求flstudio12.5注册机非真勿扰