题1005

#include 
#include 
#include 
using namespace std;
char num[10][7]={"zero","one","two","three","four","five","six","seven","eight","nine"};
int main()
{
	char s[120];
	int a[120];
	int k = 0;
	scanf("%s",s);
	int len = strlen(s);
	int sum = 0;
	for(int i = 0; i < len; i++) 
	sum += s[i] - '0';
	do{
		a[k++] = sum%10;
		sum /= 10;
	}while(sum != 0);
	for(int i = k-1; i >= 0; i--)
	{
		if(i != k-1) printf(" ");
		printf("%s",num[a[i]]);
	}
	return 0;
}

 

你可能感兴趣的:(题1005)